Skip to content

Commit 3fb0b70

Browse files
feat: add passing percent to exam card
1 parent 13c1351 commit 3fb0b70

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

public/mocks/exams.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"config": {
55
"name": "Practice Exam",
66
"note": "This exam is for learning the Exam Environment.",
7-
"totalTimeInMS": 120000,
7+
"totalTimeInS": 120,
88
"tags": [],
99
"questionSets": [
1010
{
@@ -22,7 +22,7 @@
2222
"numberOfIncorrectAnswers": 3
2323
}
2424
],
25-
"retakeTimeInMS": 0,
25+
"retakeTimeInS": 0,
2626
"passingPercent": 80.0
2727
},
2828
"questionSets": [

src/components/exam-card.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,23 @@ export function ExamCard({ exam }: ExamCardProps) {
6666
<Heading size="md" mb={2}>
6767
{exam.config.name}
6868
</Heading>
69-
<Flex alignItems="center" gap={2}>
70-
<Text color="gray.600" fontSize="sm" marginBottom={0}>
71-
Duration:
72-
</Text>
73-
<Badge colorScheme="blue" fontSize="sm">
74-
{examTimeInHumanReadableFormat(exam.config.totalTimeInS)}
75-
</Badge>
69+
<Flex justifyContent={"space-between"}>
70+
<Flex alignItems="center" gap={2}>
71+
<Text color="gray.600" fontSize="sm" marginBottom={0}>
72+
Duration:
73+
</Text>
74+
<Badge colorScheme="blue" fontSize="sm">
75+
{examTimeInHumanReadableFormat(exam.config.totalTimeInS)}
76+
</Badge>
77+
</Flex>
78+
<Flex alignItems="center" gap={2}>
79+
<Text color="gray.600" fontSize="sm" marginBottom={0}>
80+
Passing Percent:
81+
</Text>
82+
<Badge colorScheme="blue" fontSize="sm">
83+
{exam.config.passingPercent}%
84+
</Badge>
85+
</Flex>
7686
</Flex>
7787
</Box>
7888
{examStatus.status === "InProgress" && (

src/utils/fetch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export async function getExams() {
133133
note: exam.config.note,
134134
totalTimeInS: exam.config.totalTimeInS,
135135
retakeTimeInS: exam.config.retakeTimeInS,
136+
passingPercent: exam.config.passingPercent,
136137
},
137138
},
138139
];

0 commit comments

Comments
 (0)