Gradation: add route to add missing users

This commit is contained in:
nemunaire 2023-03-06 12:53:03 +01:00
commit 3397b9f123
4 changed files with 104 additions and 6 deletions

View file

@ -109,6 +109,18 @@ export class Work {
}
}
async addMissingGrades() {
const res = await fetch(`api/works/${this.id}/grades`, {
method: 'PATCH',
headers: {'Accept': 'application/json'},
});
if (res.status == 200) {
return (await res.json()).map((g) => new Grade(g));
} else {
throw new Error((await res.json()).errmsg);
}
}
async getSubmission(uid) {
const res = await fetch(uid?`api/users/${uid}/works/${this.id}/submission`:`api/works/${this.id}/submission`, {
headers: {'Accept': 'application/json'}