Prevented the stats page from crashing when there are no stats
This commit is contained in:
@@ -168,6 +168,7 @@ export default function Stats() {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{stats.length > 0 && (
|
||||
<section className="flex flex-col gap-3">
|
||||
<div className="flex gap-4 flex-wrap">
|
||||
{/* Exams per module */}
|
||||
@@ -199,7 +200,9 @@ export default function Stats() {
|
||||
</div>
|
||||
<ProgressBar
|
||||
color="listening"
|
||||
percentage={(totalExamsByModule(stats, "listening") * 100) / Object.keys(groupBySession(stats)).length}
|
||||
percentage={
|
||||
(totalExamsByModule(stats, "listening") * 100) / Object.keys(groupBySession(stats)).length
|
||||
}
|
||||
label=""
|
||||
className="h-1"
|
||||
/>
|
||||
@@ -280,6 +283,12 @@ export default function Stats() {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
{stats.length === 0 && (
|
||||
<section className="flex flex-col gap-3">
|
||||
<span className="font-semibold ml-1">No stats to display...</span>
|
||||
</section>
|
||||
)}
|
||||
</Layout>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user