Add grade filter by category
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2023-03-08 17:13:55 +01:00
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>