Compare commits
2 Commits
e8ced857e0
...
26ae032fd6
Author | SHA1 | Date | |
---|---|---|---|
26ae032fd6
|
|||
b9d6d25245
|
@ -92,7 +92,11 @@ func (app *application) CreateElection(w http.ResponseWriter, r *http.Request) {
|
|||||||
randomIdentity := randomVoterIdentity()
|
randomIdentity := randomVoterIdentity()
|
||||||
voterIdentities = append(voterIdentities, randomIdentity)
|
voterIdentities = append(voterIdentities, randomIdentity)
|
||||||
}
|
}
|
||||||
go app.voters.InsertMultiple(voterIdentities, electionId)
|
_, err = app.voters.InsertMultiple(voterIdentities, electionId)
|
||||||
|
if err != nil {
|
||||||
|
app.serverError(w, r, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
res, err = json.Marshal(api.CreateElectionResponse{VoterIdentities: &voterIdentities})
|
res, err = json.Marshal(api.CreateElectionResponse{VoterIdentities: &voterIdentities})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -192,6 +196,7 @@ func (app *application) CreateVotes(w http.ResponseWriter, r *http.Request, id i
|
|||||||
_, err := app.votes.Insert(voterIdentity, election.ID, c.ChoiceText, c.Tokens)
|
_, err := app.votes.Insert(voterIdentity, election.ID, c.ChoiceText, c.Tokens)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.serverError(w, r, err)
|
app.serverError(w, r, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user