From b2b70283ad40f17012d9dc0383e4a1292bafea0d Mon Sep 17 00:00:00 2001 From: Henri Remonen Date: Tue, 14 Mar 2023 09:00:31 +0200 Subject: [PATCH] #54 Suoritusmuoto should change the Moodle subtools --- .../components/Recommendations/Recommendations.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/components/Recommendations/Recommendations.tsx b/src/client/components/Recommendations/Recommendations.tsx index 9620fd17..c4755a12 100644 --- a/src/client/components/Recommendations/Recommendations.tsx +++ b/src/client/components/Recommendations/Recommendations.tsx @@ -80,7 +80,16 @@ const Recommendations = ({ watch }: InputProps) => { .map((aTool: ToolType[]) => aTool[0].subtools) .flat(1) // flatted the arrays into one array - return Array.from(new Set(extractedSubtools)) + const courseCompletionMethodQuestion = watch('4') + + if (courseCompletionMethodQuestion?.courseCompletionMethodExam) + extractedSubtools.push('tentti', 'tehtävä') + if (courseCompletionMethodQuestion?.courseCompletionMethodDiary) + extractedSubtools.push('tehtävä') + if (courseCompletionMethodQuestion?.courseCompletionMethodAssignment) + extractedSubtools.push('tehtävä') + + return Array.from(new Set(extractedSubtools.sort())) } const mergedRecommendationData = rawRecommendationData.map((aToolData) => ({