New button to redo gradation
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
cd500afbd5
commit
5599a94f18
@ -28,4 +28,16 @@ export class Grade {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async redoGradation() {
|
||||||
|
const res = await fetch(`api/works/${this.id_work}/grades/${this.id}/traces`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Accept': 'application/json'},
|
||||||
|
});
|
||||||
|
if (res.status == 200) {
|
||||||
|
return await res.json();
|
||||||
|
} else {
|
||||||
|
throw new Error((await res.json()).errmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,13 @@
|
|||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-success mr-1"
|
class="btn btn-sm btn-success mr-1"
|
||||||
|
title="Relancer la notation"
|
||||||
|
on:click={() => { grade.redoGradation(); }}
|
||||||
|
>
|
||||||
|
<i class="bi bi-arrow-clockwise"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-sm btn-danger mr-1"
|
||||||
title="Supprimer la note"
|
title="Supprimer la note"
|
||||||
on:click={() => { grade.delete().then(() => refresh_grades(w)); }}
|
on:click={() => { grade.delete().then(() => refresh_grades(w)); }}
|
||||||
>
|
>
|
||||||
|
20
works.go
20
works.go
@ -275,6 +275,26 @@ func declareAPIAdminWorksRoutes(router *gin.RouterGroup) {
|
|||||||
|
|
||||||
c.Redirect(http.StatusFound, fmt.Sprintf("%s/%s", droneEndpoint, repo.TestsRef))
|
c.Redirect(http.StatusFound, fmt.Sprintf("%s/%s", droneEndpoint, repo.TestsRef))
|
||||||
})
|
})
|
||||||
|
gradesRoutes.POST("/traces", func(c *gin.Context) {
|
||||||
|
w := c.MustGet("work").(*Work)
|
||||||
|
g := c.MustGet("grade").(*WorkGrade)
|
||||||
|
|
||||||
|
var u *User
|
||||||
|
if user, ok := c.Get("user"); ok {
|
||||||
|
u = user.(*User)
|
||||||
|
} else {
|
||||||
|
u = c.MustGet("LoggedUser").(*User)
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, err := u.getRepositoryByWork(g.IdWork)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Unable to getRepositoryByWork(uid=%d, wid=%d): %s", u.Id, g.IdWork, err.Error())
|
||||||
|
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Unable to find a corresponding repository."})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
TriggerTests(c, w, repo, u)
|
||||||
|
})
|
||||||
gradesRoutes.GET("/forge", func(c *gin.Context) {
|
gradesRoutes.GET("/forge", func(c *gin.Context) {
|
||||||
g := c.MustGet("grade").(*WorkGrade)
|
g := c.MustGet("grade").(*WorkGrade)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user