chore(deps): update module github.com/coreos/go-oidc to v3 - autoclosed #17
18
responses.go
18
responses.go
@ -28,6 +28,15 @@ func init() {
|
||||
if !s.Shown && (s.Direct == nil || *s.Direct != response.IdQuestion) {
|
||||
return APIErrorResponse{err: fmt.Errorf("Cette question n'est pas disponible")}
|
||||
} else if len(response.Answer) > 0 {
|
||||
// Check if the response has changed
|
||||
if response.Id != 0 {
|
||||
if res, err := s.GetResponse(int(response.Id)); err == nil {
|
||||
if res.IdUser == u.Id && res.Answer == response.Answer {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := s.NewResponse(response.IdQuestion, u.Id, response.Answer); err != nil {
|
||||
return APIErrorResponse{err: err}
|
||||
}
|
||||
@ -50,6 +59,15 @@ func init() {
|
||||
|
||||
for _, response := range responses {
|
||||
if len(response.Answer) > 0 {
|
||||
// Check if the response has changed
|
||||
if response.Id != 0 {
|
||||
if res, err := s.GetResponse(int(response.Id)); err == nil {
|
||||
if res.IdUser == u.Id && res.Answer == response.Answer {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := s.NewResponse(response.IdQuestion, u.Id, response.Answer); err != nil {
|
||||
return APIErrorResponse{err: err}
|
||||
}
|
||||
|
@ -15,7 +15,11 @@
|
||||
|
||||
const res = [];
|
||||
for (const r in responses) {
|
||||
res.push({"id_question": responses[r].id_question, "value": String(responses[r].value)})
|
||||
res.push({
|
||||
"id": responses[r].id,
|
||||
"id_question": responses[r].id_question,
|
||||
"value": String(responses[r].value)
|
||||
})
|
||||
}
|
||||
|
||||
survey.submitAnswers(res, id_user).then((response) => {
|
||||
|
Reference in New Issue
Block a user