fix: handle probes for unknown ballot ids (#7289)

This commit is contained in:
Robert Sparks 2024-04-03 16:59:52 -05:00 committed by GitHub
parent 960ede93e8
commit ed5e4863b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1548,6 +1548,7 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
def document_ballot(request, name, ballot_id=None): def document_ballot(request, name, ballot_id=None):
doc = get_object_or_404(Document, name=name) doc = get_object_or_404(Document, name=name)
all_ballots = list(BallotDocEvent.objects.filter(doc=doc, type="created_ballot").order_by("time")) all_ballots = list(BallotDocEvent.objects.filter(doc=doc, type="created_ballot").order_by("time"))
ballot = None
if not ballot_id: if not ballot_id:
if all_ballots: if all_ballots:
ballot = all_ballots[-1] ballot = all_ballots[-1]