Skip to content

Commit

Permalink
Fixed last errors from sveltekit regarding types
Browse files Browse the repository at this point in the history
  • Loading branch information
joshniemela committed Aug 18, 2024
1 parent 6ac9ce4 commit 1603619
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
9 changes: 0 additions & 9 deletions frontend/src/components/GradeGraph/GradeGraph.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// Props
export let data: Grade[] = jsonData;
export let legend: string = "Explainer";
export let title: string = "Title";
const total = data.reduce((acc, row) => acc + row.count, 0);
Expand Down Expand Up @@ -106,11 +105,3 @@
<div class="h-44">
<canvas bind:this="{graph}"></canvas>
</div>

<style scoped>
.chart-container {
position: relative; /* Important as otherwise it won't be responsive */
width: 100%;
height: fit-content;
}
</style>
4 changes: 2 additions & 2 deletions frontend/src/routes/course/[courseId]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export async function load({ fetch, params }) {
const course: Course = await res.json();
const grades = null_to_zero(transform_stats(course.statistics));
const stats = course.statistics;
if (stats !== undefined) {
stats.grades = grades;
if (stats !== null && stats !== undefined) {
stats.grades = grades !== undefined ? grades : [];
}
return {
courseId: courseId,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/course/[courseId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

<div class="block md:grid md:grid-cols-[auto_1fr] md:gap-x-10">
<div class="md:col-span-2">
{#if course["statistics"] != null}
{#if course["statistics"] != null && statistics != null}
<p>
Passed: {Math.round(statistics["pass-rate"] * 100)}%,
Average grade: {Math.round(statistics["mean"] * 100) /
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const emptyQuery = {
schedules: [],
exams: [],
departments: [],
search: null,
search: "",
};

export const queryStore = writableSession("filters", emptyQuery);
Expand All @@ -46,7 +46,7 @@ export function clearAll() {
store.schedules = [];
store.exams = [];
store.departments = [];
store.search = null;
store.search = "";
return store;
});
}
Expand Down

0 comments on commit 1603619

Please sign in to comment.