Get rid of initial "No record" positions when showing old positions,

it's just noise
 - Legacy-Id: 5312
This commit is contained in:
Ole Laursen 2013-01-21 11:54:56 +00:00
parent db2c2a418c
commit ab6a7f85c0

View file

@ -594,7 +594,13 @@ class BallotDocEvent(DocEvent):
if e.pos != prev:
latest.old_positions.append(e.pos)
# get rid of trailling "No record" positions, some old ballots
# have plenty of these
for p in positions:
while p.old_positions and p.old_positions[-1].slug == "norecord":
p.old_positions.pop()
# add any missing ADs through fake No Record events
if self.doc.active_ballot() == self:
norecord = BallotPositionName.objects.get(slug="norecord")