Merged [4909] from rjsparks@nostrum.com:
Reimplemented clear_ballot to close the existing ballot and create a new one. Changed the all_positions code to only return synthetic no-positions for current ADs when a ballot is actually open
- Legacy-Id: 4962
Note: SVN reference [4909] has been migrated to Git commit 2e6caa21b1
This commit is contained in:
commit
5eeb670b28
|
@ -567,14 +567,16 @@ class BallotDocEvent(DocEvent):
|
|||
latest.old_positions.append(e.pos)
|
||||
|
||||
# add any missing ADs through fake No Record events
|
||||
norecord = BallotPositionName.objects.get(slug="norecord")
|
||||
for ad in active_ads:
|
||||
if ad not in seen:
|
||||
e = BallotPositionDocEvent(type="changed_ballot_position", doc=self.doc, ad=ad)
|
||||
e.pos = norecord
|
||||
e.old_ad = False
|
||||
e.old_positions = []
|
||||
positions.append(e)
|
||||
if self.doc.active_ballot() == self:
|
||||
norecord = BallotPositionName.objects.get(slug="norecord")
|
||||
for ad in active_ads:
|
||||
if ad not in seen:
|
||||
e = BallotPositionDocEvent(type="changed_ballot_position", doc=self.doc, ad=ad)
|
||||
e.by = ad
|
||||
e.pos = norecord
|
||||
e.old_ad = False
|
||||
e.old_positions = []
|
||||
positions.append(e)
|
||||
|
||||
positions.sort(key=lambda p: (p.old_ad, p.ad.last_name()))
|
||||
return positions
|
||||
|
|
|
@ -296,7 +296,7 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
|
|||
|
||||
deferred = doc.active_defer_event()
|
||||
|
||||
positions = doc.active_ballot().all_positions() if doc.active_ballot() else ballot.all_positions()
|
||||
positions = ballot.all_positions()
|
||||
|
||||
# put into position groups
|
||||
position_groups = []
|
||||
|
|
Loading…
Reference in a new issue