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

A Quiz Lesson does not update progress after 30 seconds #988

Closed
Closed
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 frontend/src/components/Quiz.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
).format(quiz.data.time)
}}
</div>
<div class="leading-relaxed">
{{
__('After Submit a Quiz, please await 30 seconds to update a progress percentage!')
}}
</div>
</div>
<div v-if="activeQuestion == 0">
<div class="border text-center p-20 rounded-md">
Expand Down
19 changes: 11 additions & 8 deletions frontend/src/pages/Lesson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ const progress = createResource({
},
onSuccess(data) {
lessonProgress.value = data
if (data) {
clearInterval(timerInterval);
}
},
})

Expand Down Expand Up @@ -335,14 +338,14 @@ watch(
)

const startTimer = () => {
timerInterval = setInterval(() => {
timer.value++
if (timer.value == 30) {
clearInterval(timerInterval)
markProgress()
}
}, 1000)
}
timerInterval = setInterval(() => {
timer.value++
if (timer.value % 30 === 0) { // Check every 30 seconds
markProgress(); // Attempt to mark progress
}
}, 1000); // Timer increments every second
};


onBeforeUnmount(() => {
clearInterval(timerInterval)
Expand Down