diff --git a/app/(main)/quiz/[quiz_id]/page.tsx b/app/(main)/quiz/[quiz_id]/page.tsx index 1f74a55..d18e18c 100644 --- a/app/(main)/quiz/[quiz_id]/page.tsx +++ b/app/(main)/quiz/[quiz_id]/page.tsx @@ -39,7 +39,7 @@ const page = ({ params }: IParams) => { : setQuizFinished(true) ); } else if (res.data.steps && res.data.steps?.length > 0) { - setStep(res.data.steps[0].tapgyr); + setStep(res.data.steps[res.data.steps.length - 1].tapgyr); for (let i = 0; i < res.data.steps.length; i++) { res.data.steps[i].questions.map((question) => question.status === "active" || question.status === "new" @@ -59,7 +59,7 @@ const page = ({ params }: IParams) => { : setQuizFinished(true) ); } else if (res.data.steps && res.data.steps?.length > 0) { - setStep(res.data.steps[0].tapgyr); + setStep(res.data.steps[res.data.steps.length - 1].tapgyr); for (let i = 0; i < res.data.steps.length; i++) { res.data.steps[i].questions.map((question) => question.status === "active" || question.status === "new" diff --git a/app/(main)/quiz/[quiz_id]/results/page.tsx b/app/(main)/quiz/[quiz_id]/results/page.tsx index b81d3b7..6644099 100644 --- a/app/(main)/quiz/[quiz_id]/results/page.tsx +++ b/app/(main)/quiz/[quiz_id]/results/page.tsx @@ -28,6 +28,9 @@ const Page = ({ params }: IParams) => { Queries.getQuizById(params.quiz_id) .then((res) => { setData(res.data); + if (res.data.steps?.length) { + setTab(res.data?.steps[res.data?.steps.length - 1].tapgyr - 1); + } setLoading(false); }) .catch(() => { @@ -37,8 +40,6 @@ const Page = ({ params }: IParams) => { } }, [resultData, error]); - console.log(data); - return (
diff --git a/components/quiz/QuizTapgyrWinners.tsx b/components/quiz/QuizTapgyrWinners.tsx index 47f72da..f7a6ca6 100644 --- a/components/quiz/QuizTapgyrWinners.tsx +++ b/components/quiz/QuizTapgyrWinners.tsx @@ -3,7 +3,6 @@ import { getNextQuizWinnners, getQuizWinnersById } from "@/api/queries"; import { Question } from "@/models/quizQuestions.model"; import { Datum, - IQuizQuestionsWinners, ISearchNetije, } from "@/models/quizQuestionsWinners.model"; import { notFound } from "next/navigation"; @@ -188,11 +187,14 @@ const QuizTapgyrWinners = ({ id, tapgyr, questions }: IProps) => { : "text-textLight" }`} > - {matchingAnswer && matchingAnswer.score !== 0 - ? matchingAnswer.serial_number_for_correct - : matchingAnswer && matchingAnswer?.score === 0 - ? "X" - : "-"} + {matchingAnswer && matchingAnswer.score !== 0 ? ( + matchingAnswer.serial_number_for_correct + ) : matchingAnswer && + matchingAnswer?.score === 0 ? ( + "X" + ) : ( + - + )} ); })}