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
3 changed files with 39 additions and 0 deletions
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))
|
||||
})
|
||||
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) {
|
||||
g := c.MustGet("grade").(*WorkGrade)
|
||||
|
||||
|
|
Reference in a new issue