chore(deps): update module github.com/coreos/go-oidc to v3 - autoclosed #17
16
responses.go
16
responses.go
@ -127,6 +127,14 @@ func init() {
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
new.IdCorrector = &u.Id
|
new.IdCorrector = &u.Id
|
||||||
new.TimeScored = &now
|
new.TimeScored = &now
|
||||||
|
|
||||||
|
if _, ok := _score_cache[current.IdUser]; ok {
|
||||||
|
if surveyId, err := current.GetSurveyId(); err == nil {
|
||||||
|
if _, ok = _score_cache[current.IdUser][surveyId]; ok {
|
||||||
|
delete(_score_cache[current.IdUser], surveyId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new.Id = current.Id
|
new.Id = current.Id
|
||||||
@ -279,6 +287,14 @@ func (s *Survey) NewResponse(id_question int64, id_user int64, response string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Response) GetSurveyId() (int64, error) {
|
||||||
|
if q, err := getQuestion(int(r.IdQuestion)); err != nil {
|
||||||
|
return 0, err
|
||||||
|
} else {
|
||||||
|
return q.IdSurvey, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r Response) Update() (Response, error) {
|
func (r Response) Update() (Response, error) {
|
||||||
_, err := DBExec("UPDATE survey_responses SET id_question = ?, id_user = ?, answer = ?, time_submit = ?, score = ?, score_explanation = ?, id_corrector = ?, time_scored = ? WHERE id_response = ?", r.IdQuestion, r.IdUser, r.Answer, r.TimeSubmit, r.Score, r.ScoreExplaination, r.IdCorrector, r.TimeScored, r.Id)
|
_, err := DBExec("UPDATE survey_responses SET id_question = ?, id_user = ?, answer = ?, time_submit = ?, score = ?, score_explanation = ?, id_corrector = ?, time_scored = ? WHERE id_response = ?", r.IdQuestion, r.IdUser, r.Answer, r.TimeSubmit, r.Score, r.ScoreExplaination, r.IdCorrector, r.TimeScored, r.Id)
|
||||||
return r, err
|
return r, err
|
||||||
|
Reference in New Issue
Block a user