feat: 학생 퀴즈 리포트 미응시 데이터 처리 추가
This commit is contained in:
parent
bd182f5c2a
commit
48fdb57d2e
@ -12,8 +12,10 @@ export default function StudentReportPage() {
|
||||
|
||||
const totalCounts = reports.reduce(
|
||||
(acc, report) => {
|
||||
acc.correctCount += report.correctCount;
|
||||
acc.allCount += report.allCount;
|
||||
if (acc.allCount > 0) {
|
||||
acc.correctCount += report.correctCount;
|
||||
acc.allCount += report.allCount;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{ correctCount: 0, allCount: 0 }
|
||||
@ -30,7 +32,7 @@ export default function StudentReportPage() {
|
||||
<ArticleLink
|
||||
key={`${report.reportId}`}
|
||||
title={report.title}
|
||||
sub={`${Math.round((report.correctCount / report.allCount) * 100)}%`}
|
||||
sub={report.allCount === 0 ? '미응시' : `${Math.round((report.correctCount / report.allCount) * 100)}%`}
|
||||
to={`${report.reportId}`}
|
||||
/>
|
||||
))}
|
||||
|
Loading…
Reference in New Issue
Block a user