qa: Auto-solve OK requests
This commit is contained in:
parent
8758effc99
commit
67f129ce4c
3 changed files with 8 additions and 5 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
|
||||
|
@ -105,7 +106,9 @@ func createExerciceQA(c *gin.Context) {
|
|||
|
||||
if len(uq.Subject) == 0 {
|
||||
if uq.State == "ok" {
|
||||
tmp := time.Now()
|
||||
uq.Subject = "RAS"
|
||||
uq.Solved = &tmp
|
||||
} else {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Subject not filled"})
|
||||
return
|
||||
|
@ -113,7 +116,7 @@ func createExerciceQA(c *gin.Context) {
|
|||
}
|
||||
|
||||
exercice := c.MustGet("exercice").(*fic.Exercice)
|
||||
qa, err := exercice.NewQAQuery(uq.Subject, &teamid, ficteam, uq.State)
|
||||
qa, err := exercice.NewQAQuery(uq.Subject, &teamid, ficteam, uq.State, uq.Solved)
|
||||
if err != nil {
|
||||
log.Println("Unable to NewQAQuery: ", err.Error())
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Unable to create the new QA query. Please retry."})
|
||||
|
|
Reference in a new issue