Skip to content

Commit 2253be2

Browse files
committed
Fix missing revision numbers
- Legacy-Id: 3680
1 parent 5a4c23e commit 2253be2

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

ietf/idrfc/idrfc_wrapper.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,15 @@ def _init(self):
724724
return
725725

726726
from redesign.person.models import Person
727+
from redesign.doc.models import BallotPositionDocEvent, NewRevisionDocEvent
728+
727729
active_ads = Person.objects.filter(role__name="ad", role__group__state="active").distinct()
728730

729731
positions = []
730732
seen = {}
731733

732-
from doc.models import BallotPositionDocEvent
734+
new_revisions = list(NewRevisionDocEvent.objects.filter(doc=self.ballot, type="new_revision").order_by('-time', '-id'))
735+
733736
for pos in BallotPositionDocEvent.objects.filter(doc=self.ballot, type="changed_ballot_position", time__gte=self.ballot.process_start, time__lte=self.ballot.process_end).select_related('ad').order_by("-time", '-id'):
734737
if pos.ad not in seen:
735738
p = dict(ad_name=pos.ad.name,
@@ -738,17 +741,23 @@ def _init(self):
738741
is_old_ad=pos.ad not in active_ads,
739742
old_positions=[])
740743

744+
rev = pos.doc.rev
745+
for n in new_revisions:
746+
if n.time <= pos.time:
747+
rev = n.rev
748+
break
749+
741750
if pos.pos.slug == "discuss":
742751
p["has_text"] = True
743752
p["discuss_text"] = pos.discuss
744753
p["discuss_date"] = pos.discuss_time
745-
p["discuss_revision"] = pos.doc.rev # FIXME: wrong
754+
p["discuss_revision"] = rev
746755

747756
if pos.comment:
748757
p["has_text"] = True
749758
p["comment_text"] = pos.comment
750759
p["comment_date"] = pos.comment_time
751-
p["comment_revision"] = pos.doc.rev # FIXME: wrong
760+
p["comment_revision"] = rev
752761

753762
positions.append(p)
754763
seen[pos.ad] = p
@@ -771,6 +780,7 @@ def _init(self):
771780
position="No Record",
772781
)
773782
positions.append(d)
783+
774784
self._positions = positions
775785

776786
def old_init(self):

0 commit comments

Comments
 (0)