Add grade filter by category
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2023-03-08 17:13:55 +01:00
parent 9ad021fa65
commit 19a759536b
4 changed files with 29 additions and 2 deletions

View File

@ -1,8 +1,10 @@
<script>
import { getCategories } from '$lib/categories';
import { getSurveys } from '$lib/surveys';
import { getUsers, getGrades, getPromos } from '$lib/users';
export let promo = null;
export let category = null;
</script>
{#await getPromos() then promos}
@ -15,6 +17,18 @@
</select>
</div>
{/await}
{#await getCategories() then categories}
<div class="float-end me-2">
<select class="form-select" bind:value={category}>
<option value={null}>toutes</option>
{#each categories as categ (categ.id)}
{#if !promo || categ.promo == promo}
<option value={categ.id}>{categ.label}</option>
{/if}
{/each}
</select>
</div>
{/await}
<h2>
Étudiants {#if promo !== null}{promo}{/if}
<small class="text-muted">Notes</small>
@ -39,7 +53,7 @@
<th>ID</th>
<th>Login</th>
{#each surveys as survey}
{#if survey.corrected && (!promo || survey.promo == promo)}
{#if survey.corrected && (!promo || survey.promo == promo) && (!category || survey.id_category == category)}
<th>
{#if survey.kind == "survey"}
<a href="surveys/{survey.id}" style="text-decoration: none">{survey.title}</a>
@ -68,7 +82,7 @@
<td><a href="users/{user.id}" style="text-decoration: none">{user.id}</a></td>
<td><a href="users/{user.login}" style="text-decoration: none">{user.login}</a></td>
{#each surveys as survey}
{#if survey.corrected && (!promo || survey.promo == promo)}
{#if survey.corrected && (!promo || survey.promo == promo) && (!category || survey.id_category == category)}
<td>
{grades[user.id] && grades[user.id][survey.kind + "." + survey.id]?grades[user.id][survey.kind + "." + survey.id]:""}
</td>

View File

@ -0,0 +1,6 @@
export async function load({ params }) {
return {
promo: parseInt(params.promo),
cid: parseInt(params.cid),
};
}

View File

@ -0,0 +1,7 @@
<script>
import StudentGrades from '$lib/components/StudentGrades.svelte';
export let data;
</script>
<StudentGrades promo={data.promo} category={data.cid} />