Gradation: add route to add missing users
This commit is contained in:
parent
107b17c11f
commit
3397b9f123
4 changed files with 104 additions and 6 deletions
|
|
@ -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'}
|
||||
|
|
|
|||
Reference in a new issue