Skip to content

Commit

Permalink
fix(frontend): backend is not ready for quiz restarting so only used …
Browse files Browse the repository at this point in the history
…resume
  • Loading branch information
Elifnurdeniz committed Dec 16, 2024
1 parent a37d7b4 commit 065811b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
5 changes: 0 additions & 5 deletions frontend/src/pages/quiz-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,6 @@ export default function QuizDetails() {
className="w-1/3 items-center text-center mt-3">
Start Quiz
</Button>
{hasAttempted && (
<Button color="primary" variant="faded" onClick={() => navigate(`/quiz/${quizData?.id}`, { state: { isNotResuming: false } })} className="w-1/4 items-center text-center mt-3">
Resume Quiz
</Button>
)}
</div>
</div>
</CardBody>
Expand Down
18 changes: 5 additions & 13 deletions frontend/src/pages/quiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,10 @@ export default function Quiz() {
.then((response) => {
console.log(response.data);
setQuizData(response.data); // Store response data
if (isNotResuming) {
const initialAnswers = response.data.questions.map(
(question: any) => Answer.None
);
setAnswers(initialAnswers);
} else {
const initialAnswers = response.data.questions.map(
(question: any) => question.previous_answer || Answer.None
);
setAnswers(initialAnswers);
}
const initialAnswers = response.data.questions.map(
(question: any) => question.previous_answer || Answer.None
);
setAnswers(initialAnswers);
})
.catch((error) => {
console.log(error);
Expand All @@ -78,7 +71,6 @@ export default function Quiz() {
return (
<div className="h-screen w-screen flex flex-col">
<Navbar />

<SidebarLayout
id={quizID}
quiz_progress_id={quizData?.quiz_progress_id}
Expand All @@ -102,7 +94,7 @@ export default function Quiz() {
)}
{isLoading ? (
<div className="mt-5"><QuizDetailsCardSkeleton /></div>

) : (
<div className="flex flex-col items-center py-4">
<h1 className="font-semibold text-4xl mt-3 mb-4 text-blue-900">
Expand Down

0 comments on commit 065811b

Please sign in to comment.