Skip to content
Merged
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
13 changes: 7 additions & 6 deletions frontend/src/app/components/timer/timer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
seconds: number;
private clockHandler: NodeJS.Timeout | null;
elapsedSeconds: number = 0;
private alarmOn: boolean;
private alarmRinging: boolean;
totalTime: number;
increasedTime: number = 0;
started: boolean = false;
Expand Down Expand Up @@ -156,6 +156,7 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
startTimer(): void {
this.started = true;
this.onPlayPressed.emit([this.elapsedSeconds]);
this.alarmRinging = false;
};

pauseTimer(): void {
Expand All @@ -169,7 +170,7 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
}
this.onTimerFinished.emit([true]);
this.resetVariables(this.minutes, this.seconds, false);
this.alarmOn = false;
this.alarmRinging = false;
this.elapsedSeconds = 0;
//Removing focus from the button for finishing timer, or space key will also finish the duel.
if (document.activeElement) {
Expand All @@ -191,7 +192,7 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
this.elapsedSeconds = 0;
this.onTimerChanged.emit([this.elapsedSeconds]);
this.resetVariablesAsSeconds(this.totalTime + this.increasedTime, false);
this.alarmOn = false;
this.alarmRinging = false;
}
});
}
Expand All @@ -216,8 +217,8 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
this.seconds--;
}
//Here only is launched when seconds changes from 1 to 0.
if (this.seconds === 0 && this.minutes === 0 && !this.alarmOn) {
this.alarmOn = true;
if (this.seconds === 0 && this.minutes === 0 && !this.alarmRinging) {
this.alarmRinging = true;
this.audioService.playWhistleByTime(4);
this.pauseTimer();
}
Expand Down Expand Up @@ -262,7 +263,7 @@ export class TimerComponent extends RbacBasedComponent implements OnInit {
}
this.timeDurationChanged.emit([rawSeconds + this.elapsedSeconds]);
this.onTimerChanged.emit([this.elapsedSeconds]);
this.alarmOn = false;
this.alarmRinging = false;
}

setMinutesEditable(editable: boolean): void {
Expand Down
Loading