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>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
{stats.length > 0 && (
|
||||||
<section className="flex flex-col gap-3">
|
<section className="flex flex-col gap-3">
|
||||||
<div className="flex gap-4 flex-wrap">
|
<div className="flex gap-4 flex-wrap">
|
||||||
{/* Exams per module */}
|
{/* Exams per module */}
|
||||||
@@ -199,7 +200,9 @@ export default function Stats() {
|
|||||||
</div>
|
</div>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
color="listening"
|
color="listening"
|
||||||
percentage={(totalExamsByModule(stats, "listening") * 100) / Object.keys(groupBySession(stats)).length}
|
percentage={
|
||||||
|
(totalExamsByModule(stats, "listening") * 100) / Object.keys(groupBySession(stats)).length
|
||||||
|
}
|
||||||
label=""
|
label=""
|
||||||
className="h-1"
|
className="h-1"
|
||||||
/>
|
/>
|
||||||
@@ -280,6 +283,12 @@ export default function Stats() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
)}
|
||||||
|
{stats.length === 0 && (
|
||||||
|
<section className="flex flex-col gap-3">
|
||||||
|
<span className="font-semibold ml-1">No stats to display...</span>
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
</Layout>
|
</Layout>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user