Skip to content

Commit 8bb6994

Browse files
fix(client): align attempt result type with api (freeCodeCamp#63844)
1 parent e3fc2b0 commit 8bb6994

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

client/src/templates/Challenges/exam-download/attempts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ export function Attempts({ examChallengeId }: AttemptsProps) {
6767
function renderStatus(attempt: Attempt) {
6868
switch (attempt.status) {
6969
case 'Approved':
70-
return attempt.result.passed ? t('exam.passed') : t('exam.failed');
70+
return attempt.result.score >= attempt.result.passingPercent
71+
? t('exam.passed')
72+
: t('exam.failed');
7173
case 'Denied':
7274
return t('exam.denied');
7375
case 'InProgress':

client/src/utils/ajax.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export type Attempt = {
234234
| {
235235
status: 'Approved';
236236
result: {
237-
passed: boolean;
237+
passingPercent: number;
238238
score: number;
239239
};
240240
}

0 commit comments

Comments
 (0)