Don't create responses from web interface

This commit is contained in:
Andrea Fazzi 2020-01-21 17:25:06 +01:00
parent 3596e9160d
commit 39520a9acc

View file

@ -217,17 +217,18 @@ func (model *Participant) Create(db *Database, args map[string]string, w http.Re
return nil, err
}
var response Response
// FIXME: Should be managed by API
// var response Response
if err := db._db.First(&response, &Response{ParticipantID: participant.ID}).Error; err != nil {
return nil, err
}
// if err := db._db.First(&response, &Response{ParticipantID: participant.ID}).Error; err != nil {
// return nil, err
// }
response.UserModifierCreate = NewUserModifierCreate(db, r)
// response.UserModifierCreate = NewUserModifierCreate(db, r)
if err := db._db.Save(&response).Error; err != nil {
return nil, err
}
// if err := db._db.Save(&response).Error; err != nil {
// return nil, err
// }
return participant, nil
}
@ -378,17 +379,18 @@ func (model *Participant) Update(db *Database, args map[string]string, w http.Re
return nil, err
}
var response Response
// FIXME: Should be managed by API
// var response Response
if err := db._db.First(&response, &Response{ParticipantID: participant.(*Participant).ID}).Error; err != nil {
return nil, err
}
// if err := db._db.First(&response, &Response{ParticipantID: participant.(*Participant).ID}).Error; err != nil {
// return nil, err
// }
response.UserModifierUpdate = NewUserModifierUpdate(db, r)
// response.UserModifierUpdate = NewUserModifierUpdate(db, r)
if err := db._db.Save(&response).Error; err != nil {
return nil, err
}
// if err := db._db.Save(&response).Error; err != nil {
// return nil, err
// }
return participant.(*Participant), nil
}