Skip to content

Commit 84be6c2

Browse files
committed
Notification Settings
1 parent fb04f79 commit 84be6c2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

frontend/components/Course/InstructorQueuePage/QuestionTimer.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect } from "react";
22
import { Label } from "semantic-ui-react";
33
import timerAudio from "./timeupsound.mp3";
44
import { usePlayer } from "../../../hooks/player";
5+
import { checkPermissions } from "../../../utils/notifications";
56

67
interface QuestionTimerProps {
78
questionStartTime: string;
@@ -14,7 +15,7 @@ const QuestionTimer = ({
1415
const [, , play] = usePlayer(timerAudio);
1516
const now = Date.now();
1617
const diff =
17-
(timerStartTime / 10) * 60 * 1000 -
18+
timerStartTime * 60 * 1000 -
1819
(now - new Date(questionStartTime).getTime());
1920
const minutes = Math.floor(Math.abs(diff) / (1000 * 60));
2021
const seconds = Math.floor((Math.abs(diff) % (1000 * 60)) / 1000);
@@ -23,9 +24,10 @@ const QuestionTimer = ({
2324
// Play a sound effect when hit zero (once)
2425
useEffect(() => {
2526
if (minutes + seconds === 0) {
26-
play.current(
27-
`Timer is up! You have answered this question for ${timerStartTime} minute(s).`
28-
);
27+
if (!checkPermissions())
28+
play.current(
29+
`Timer is up! You have answered this question for ${timerStartTime} minute(s).`
30+
);
2931
}
3032
}, [sign]);
3133
const formated = `${sign}${minutes.toString().padStart(2, "0")}:${seconds

0 commit comments

Comments
 (0)