Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow add time to aux timer #1357

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/server/src/api-integration/integration.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ const actionHandlers: Record<string, ActionHandler> = {
const timeInMs = numberOrError(command.duration) * 1000;
reply.payload = auxTimerService.setTime(timeInMs);
}
if ('addtime' in command) {
// convert addTime in seconds to ms
const timeInMs = numberOrError(command.addtime) * 1000;
reply.payload = auxTimerService.addTime(timeInMs);
}
if ('direction' in command) {
if (command.direction === SimpleDirection.CountUp || command.direction === SimpleDirection.CountDown) {
reply.payload = auxTimerService.setDirection(command.direction);
Expand Down
5 changes: 5 additions & 0 deletions apps/server/src/services/aux-timer-service/AuxTimerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export class AuxTimerService {
return this.timer.setTime(duration);
}

@broadcastReturn
addTime(millis: number) {
return this.timer.setTime(this.timer.state.current + millis);
}

@broadcastReturn
private update() {
return this.timer.update(this.getTime());
Expand Down