Skip to content

Commit ecdcf63

Browse files
Merge pull request #202 from swamphacks/fix/undefined_submission_stats
Fixed undefined submission stats
2 parents e11671d + 92206c8 commit ecdcf63

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

apps/web/src/features/Application/components/SubmissionsChart.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTheme } from "@/components/ThemeProvider";
33
import { useMemo } from "react";
44

55
interface SubmissionsChartProps {
6-
submission_stats: {
6+
submission_stats?: {
77
count: number;
88
day: string;
99
}[];
@@ -20,16 +20,18 @@ export default function SubmissionsChart({
2020
const labels: string[] = [];
2121
const values: number[] = [];
2222

23-
for (const submission of submission_stats) {
24-
labels.push(
25-
new Date(submission.day).toLocaleDateString(undefined, {
26-
weekday: "narrow",
27-
month: "short",
28-
day: "numeric",
29-
timeZone: "UTC",
30-
}),
31-
);
32-
values.push(submission.count);
23+
if (submission_stats) {
24+
for (const submission of submission_stats) {
25+
labels.push(
26+
new Date(submission.day).toLocaleDateString(undefined, {
27+
weekday: "narrow",
28+
month: "short",
29+
day: "numeric",
30+
timeZone: "UTC",
31+
}),
32+
);
33+
values.push(submission.count);
34+
}
3335
}
3436

3537
return { labels, values };

0 commit comments

Comments
 (0)