diff --git a/src/app/(withAuth)/courses/[courseId]/Course.tsx b/src/app/(withAuth)/courses/[courseId]/Course.tsx index 7c9d0023..67903cb6 100644 --- a/src/app/(withAuth)/courses/[courseId]/Course.tsx +++ b/src/app/(withAuth)/courses/[courseId]/Course.tsx @@ -18,6 +18,7 @@ import { Td, Th, Flex, + HStack, } from '@chakra-ui/react'; import Image from 'next/image'; import NextLink from 'next/link'; @@ -55,6 +56,15 @@ export const Course: React.FC<{ ).length; }; + const countCompletedProblems = (programIds: string[], languageId: string): number => { + let count = 0; + + for (const programId of programIds) { + if (countUserSolvedProblems(programId, languageId) >= SPECIFIED_COMPLETION_COUNT) count++; + } + return count; + }; + return (
@@ -79,8 +89,20 @@ export const Course: React.FC<{ - - 第{iLesson + 1}回 + + + 第{iLesson + 1}回 + + + Completed {countCompletedProblems(programIds, selectedLanguageId)} / {programIds.length} + + {countCompletedProblems(programIds, selectedLanguageId) >= programIds.length && ( + + 完了の王冠 + + )} + +