Skip to content

Commit 19b572b

Browse files
committed
Fix problem with multiple ballot rounds on a draft that later becomes an RFC
- Legacy-Id: 2759
1 parent d7c6d28 commit 19b572b

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

ietf/idrfc/idrfc_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def _init(self):
637637
seen = {}
638638

639639
from doc.models import BallotPosition
640-
for pos in BallotPosition.objects.filter(doc=self.ballot, type="changed_ballot_position").select_related('ad').order_by("-time", '-id'):
640+
for pos in BallotPosition.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'):
641641
if pos.ad not in seen:
642642
p = dict(ad_name=pos.ad.get_name(),
643643
ad_username="", # FIXME: don't seem to have username at the moment

ietf/idrfc/views_doc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def _get_html(key, filename):
7777

7878
def document_main_rfc(request, rfc_number):
7979
rfci = get_object_or_404(RfcIndex, rfc_number=rfc_number)
80+
rfci.viewing_as_rfc = True
8081
doc = RfcWrapper(rfci)
8182

8283
info = {}

redesign/doc/proxy.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,33 @@ def review_by_rfc_editor(self):
160160
@property
161161
def expired_tombstone(self):
162162
return bool(self.tags.filter(slug='exp-tomb'))
163-
163+
164+
def calc_process_start_end(self):
165+
import datetime
166+
start, end = datetime.datetime.min, datetime.datetime.max
167+
e = self.ballot.latest_event(type="started_iesg_process")
168+
if e:
169+
start = e.time
170+
if self.ballot.state_id == "rfc" and self.ballot.name.startswith("draft") and not hasattr(self.ballot, "viewing_as_rfc"):
171+
previous_process = self.ballot.latest_event(type="started_iesg_process", time__lt=e.time)
172+
if previous_process:
173+
start = previous_process.time
174+
end = e.time
175+
self._process_start = start
176+
self._process_end = end
177+
178+
@property
179+
def process_start(self):
180+
if not hasattr(self, "_process_start"):
181+
self.calc_process_start_end()
182+
return self._process_start
183+
184+
@property
185+
def process_end(self):
186+
if not hasattr(self, "_process_end"):
187+
self.calc_process_start_end()
188+
return self._process_end
189+
164190
#idinternal = FKAsOneToOne('idinternal', reverse=True, query=models.Q(rfc_flag = 0))
165191
@property
166192
def idinternal(self):

redesign/import-document-state.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def import_from_idinternal(d, idinternal):
262262

263263
# extract events
264264
last_note_change_text = ""
265+
started_iesg_process = ""
265266

266267
document_comments = DocumentComment.objects.filter(document=idinternal.draft_id).order_by('date', 'time', 'id')
267268
for c in document_comments:
@@ -431,8 +432,12 @@ def import_from_idinternal(d, idinternal):
431432
# draft added
432433
match = re_draft_added.search(c.comment_text)
433434
if match:
434-
e = Event(type="started_iesg_process")
435-
save_event(d, e, c)
435+
# watch out for extraneous starts, the old data contains
436+
# some phony ones
437+
if not started_iesg_process:
438+
started_iesg_process = c.comment_text
439+
e = Event(type="started_iesg_process")
440+
save_event(d, e, c)
436441
handled = True
437442

438443
# new version

0 commit comments

Comments
 (0)