Internal Server Error (HTTP 500) when deleting a candidate
Closed this issue · 0 comments
ion-oset commented
HTTP request: DELETE /candidates/cnd_Cosmo_Spacely
Exception:
File "src/electos/versadm/app/routers/common.py", line 14, in wrapped
func_result = func(*args, **kwargs)
File "src/electos/versadm/app/routers/candidate.py", line 66, in delete_candidate
contests = [contest for contest in app_state.contests.values()
File "src/electos/versadm/app/routers/candidate.py", line 67, in <listcomp>
if candidate.obj_id in _candidate_obj_refs(contest)]
File "src/electos/versadm/app/routers/candidate.py", line 27, in _candidate_obj_refs
return {cand_id for c_sel in contest.contest_selection for cand_id in c_sel.candidate_ids}
File "src/electos/versadm/app/routers/candidate.py", line 27, in <setcomp>
return {cand_id for c_sel in contest.contest_selection for cand_id in c_sel.candidate_ids}
AttributeError: 'BallotMeasureSelection' object has no attribute 'candidate_ids'
Steps to replicate (from root of Versa checkout). Assumes a running Versa instance.
- Set up
$ curl -X PUT 'http://localhost:8080/admin/load_election_data' -H 'Content-Type: application/json' --data-binary '@./test/resources/jetsons.json
- Delete candidate
$ curl -X DELETE 'http://localhost:8080/candidates/cnd_Cosmo_Spacely' -H 'Content-Type: application/json'