File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 4242 >:
4343 {{
4444 t("Headings.AmountSolvedQuizzes", {
45- amount: arrayOfSubtasks.filter((quiz: any) => !quiz.solved).length ,
46- total: arrayOfSubtasks?.length ,
45+ amount: solvedSubtaskCount ,
46+ total: totalSubtaskCount ,
4747 })
4848 }}
4949 </p >
9898 />
9999 </div >
100100 </main >
101- <div
102- v-if ="
103- !loading &&
104- quizzesToShow.length > 0 &&
105- arrayOfSubtasks.filter((quiz: any) => !quiz.solved).length == 0
106- "
107- >
101+ <div v-if =" !loading && quizzesToShow.length > 0 && unsolvedSubtaskCount === 0" >
108102 <CheckCircleIcon class =" mx-auto mb-8 h-20 w-20 text-accent" />
109103 <p class =" mb-20 w-full text-center text-xl" >
110104 {{ t("Headings.AllSolved") }}
@@ -155,6 +149,12 @@ const buttonOptions = [
155149 { name: " Buttons.Own" },
156150];
157151
152+ const totalSubtaskCount = computed (() => arrayOfSubtasks .value .length );
153+ const solvedSubtaskCount = computed (
154+ () => arrayOfSubtasks .value .filter ((quiz : any ) => quiz .solved ).length
155+ );
156+ const unsolvedSubtaskCount = computed (() => totalSubtaskCount .value - solvedSubtaskCount .value );
157+
158158const id: any = computed (() => route ?.params ?.id ?? " " );
159159const querySubTaskId: any = computed (() => route .query ?.querySubTaskId ?? " " );
160160const taskId = computed (() => route .query ?.taskId ?? " " );
Original file line number Diff line number Diff line change 4242 >:
4343 {{
4444 t("Headings.AmountSolvedQuizzes", {
45- amount: arrayOfSubtasks.filter((quiz: any) => !quiz.solved).length ,
46- total: arrayOfSubtasks?.length ,
45+ amount: solvedSubtaskCount ,
46+ total: totalSubtaskCount ,
4747 })
4848 }}
4949 </p >
9999 />
100100 </div >
101101 </main >
102- <div
103- v-if ="
104- !loading &&
105- quizzesToShow.length > 0 &&
106- arrayOfSubtasks.filter((quiz: any) => !quiz.solved).length == 0
107- "
108- >
102+ <div v-if =" !loading && quizzesToShow.length > 0 && unsolvedSubtaskCount === 0" >
109103 <CheckCircleIcon class =" mx-auto mb-8 h-20 w-20 text-accent" />
110104 <p class =" mb-20 w-full text-center text-xl" >
111105 {{ t("Headings.AllSolved") }}
@@ -329,6 +323,12 @@ export default defineComponent({
329323 return quiz .creator === user .value ?.id ;
330324 }
331325
326+ const totalSubtaskCount = computed (() => arrayOfSubtasks .value .length );
327+ const solvedSubtaskCount = computed (
328+ () => arrayOfSubtasks .value .filter ((quiz : any ) => quiz .solved ).length
329+ );
330+ const unsolvedSubtaskCount = computed (() => totalSubtaskCount .value - solvedSubtaskCount .value );
331+
332332 function sortQuizzes() {
333333 return quizzesToShow .value .sort (
334334 (
@@ -406,6 +406,9 @@ export default defineComponent({
406406 breadcrumbs ,
407407 querySubTaskId ,
408408 sortQuizzes ,
409+ totalSubtaskCount ,
410+ solvedSubtaskCount ,
411+ unsolvedSubtaskCount ,
409412 };
410413 },
411414});
You can’t perform that action at this time.
0 commit comments