-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
81 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
web/src/routes/homework/[semester]/[homework_name]/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import type { PageData } from './$types'; | ||
import * as Table from '$lib/components/ui/table'; | ||
let { data }: { data: PageData } = $props(); | ||
</script> | ||
|
||
<h1 class="scroll-m-20 text-4xl font-bold tracking-tight lg:text-5xl"> | ||
{data.data.semester.toUpperCase()} | ||
{data.data.name} | ||
</h1> | ||
|
||
<div class="my-6 w-full"> | ||
<Table.Root> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.Head>Student ID</Table.Head> | ||
<Table.Head>Grade</Table.Head> | ||
</Table.Row> | ||
</Table.Header> | ||
|
||
<Table.Body> | ||
{#each data.data.info as i} | ||
<Table.Row> | ||
<Table.Cell> | ||
<a | ||
href={`/student/${data.data.semester}/${i.student_id}`} | ||
class="text-primary underline hover:text-primary/70" | ||
> | ||
{i.student_id} | ||
</a> | ||
</Table.Cell> | ||
<Table.Cell>{i.grade ?? 'Not submitted'}</Table.Cell> | ||
</Table.Row> | ||
{/each} | ||
</Table.Body> | ||
</Table.Root> | ||
</div> |
24 changes: 24 additions & 0 deletions
24
web/src/routes/homework/[semester]/[homework_name]/+page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { error } from '@sveltejs/kit'; | ||
import type { PageLoad } from './$types'; | ||
|
||
type GradeInfo = { | ||
student_id: string; | ||
grade: number | null; | ||
}; | ||
|
||
export const load: PageLoad = async ({ params, fetch }) => { | ||
const res = await fetch(`/api/grade/${params.semester}/${params.homework_name}`); | ||
if (!res.ok) { | ||
error(res.status, await res.json()); | ||
} | ||
|
||
const info: GradeInfo[] = await res.json(); | ||
|
||
return { | ||
data: { | ||
semester: params.semester, | ||
name: params.homework_name, | ||
info | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...c/routes/[semester]/[student_id]/+page.ts → .../student/[semester]/[student_id]/+page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters