Fix problem with multiple ballot rounds on a draft that later becomes an RFC

- Legacy-Id: 2759
This commit is contained in:
Ole Laursen 2011-01-24 20:20:50 +00:00
parent d7c6d28f2e
commit 19b572b285
4 changed files with 36 additions and 4 deletions

View file

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

View file

@ -77,6 +77,7 @@ def _get_html(key, filename):
def document_main_rfc(request, rfc_number):
rfci = get_object_or_404(RfcIndex, rfc_number=rfc_number)
rfci.viewing_as_rfc = True
doc = RfcWrapper(rfci)
info = {}

View file

@ -160,7 +160,33 @@ class InternetDraft(Document):
@property
def expired_tombstone(self):
return bool(self.tags.filter(slug='exp-tomb'))
def calc_process_start_end(self):
import datetime
start, end = datetime.datetime.min, datetime.datetime.max
e = self.ballot.latest_event(type="started_iesg_process")
if e:
start = e.time
if self.ballot.state_id == "rfc" and self.ballot.name.startswith("draft") and not hasattr(self.ballot, "viewing_as_rfc"):
previous_process = self.ballot.latest_event(type="started_iesg_process", time__lt=e.time)
if previous_process:
start = previous_process.time
end = e.time
self._process_start = start
self._process_end = end
@property
def process_start(self):
if not hasattr(self, "_process_start"):
self.calc_process_start_end()
return self._process_start
@property
def process_end(self):
if not hasattr(self, "_process_end"):
self.calc_process_start_end()
return self._process_end
#idinternal = FKAsOneToOne('idinternal', reverse=True, query=models.Q(rfc_flag = 0))
@property
def idinternal(self):

View file

@ -262,6 +262,7 @@ def import_from_idinternal(d, idinternal):
# extract events
last_note_change_text = ""
started_iesg_process = ""
document_comments = DocumentComment.objects.filter(document=idinternal.draft_id).order_by('date', 'time', 'id')
for c in document_comments:
@ -431,8 +432,12 @@ def import_from_idinternal(d, idinternal):
# draft added
match = re_draft_added.search(c.comment_text)
if match:
e = Event(type="started_iesg_process")
save_event(d, e, c)
# watch out for extraneous starts, the old data contains
# some phony ones
if not started_iesg_process:
started_iesg_process = c.comment_text
e = Event(type="started_iesg_process")
save_event(d, e, c)
handled = True
# new version