qa: New route to assign all exercices

This commit is contained in:
nemunaire 2024-09-18 12:32:11 +02:00
commit 2f6c7ecd8b
2 changed files with 93 additions and 3 deletions

View file

@ -4,7 +4,9 @@
import { teams } from '$lib/stores/teams';
import {
Button,
Container,
Input,
Table,
} from '@sveltestrap/sveltestrap';
@ -16,12 +18,44 @@
function show(id) {
goto("teams/" + id)
}
let start = 0;
let turns = 3;
async function assignExercices() {
const res = await fetch(`api/qa_assign_work`, {
method: 'POST',
headers: {'Accept': 'application/json'},
body: JSON.stringify({
start,
turns,
}),
})
if (res.status == 200) {
teams.refresh();
} else {
throw new Error((await res.json()).errmsg);
}
}
</script>
<Container class="mt-2 mb-5">
<h2>
Équipes
</h2>
<div class="d-flex justify-content-between">
<h2>
Équipes
</h2>
<div class="input-group">
<Input type="number" bind:value={start} />
<Input type="number" bind:value={turns} />
<Button
color="light"
size="sm"
on:click={assignExercices}
>
Assigner des exercices
</Button>
</div>
</div>
<p>
<input type="search" class="form-control" placeholder="Filtrer" bind:value={query} autofocus>