Able to make corrections
This commit is contained in:
parent
6f958bdab4
commit
d77e6e2eac
22 changed files with 1085 additions and 80 deletions
16
responses.go
16
responses.go
|
@ -85,6 +85,22 @@ func init() {
|
|||
new.TimeScored = &now
|
||||
}
|
||||
|
||||
new.Id = current.Id
|
||||
new.IdUser = current.IdUser
|
||||
return formatApiResponse(new.Update())
|
||||
}), adminRestricted))
|
||||
router.PUT("/api/questions/:qid/responses/:rid", apiAuthHandler(responseAuthHandler(func(current Response, u *User, body []byte) HTTPResponse {
|
||||
var new Response
|
||||
if err := json.Unmarshal(body, &new); err != nil {
|
||||
return APIErrorResponse{err: err}
|
||||
}
|
||||
|
||||
if new.Score != nil && (current.Score == nil || *new.Score != *current.Score) {
|
||||
now := time.Now()
|
||||
new.IdCorrector = &u.Id
|
||||
new.TimeScored = &now
|
||||
}
|
||||
|
||||
new.Id = current.Id
|
||||
new.IdUser = current.IdUser
|
||||
return formatApiResponse(new.Update())
|
||||
|
|
Reference in a new issue