Fetch all categories before updating participant

This commit is contained in:
Andrea Fazzi 2019-12-09 15:23:44 +01:00
parent 8ceb259ca8
commit 92a1f141a0

View file

@ -261,6 +261,13 @@ func (model *Participant) Update(args map[string]string, w http.ResponseWriter,
participant.SelectedCategory = make(map[uint]string)
participant.SelectedCategory[participant.CategoryID] = "selected"
} else {
if err := DB().Find(&participant.AllCategories).Error; err != nil {
return nil, err
}
participant.SelectedCategory = make(map[uint]string)
participant.SelectedCategory[participant.CategoryID] = "selected"
if err := DB().Find(&participant.AllContests).Error; err != nil {
return nil, err
}