From 7ad34ba69e836dfa06f7c05a5539d4f745b7efe6 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Wed, 28 Aug 2019 20:56:34 +0000 Subject: [PATCH] The logic for displaying 'Email requested to be sent for earlier discuss' on IESG positions was wrong; it would count later discusses and discusses from other ADs as an 'earlier discuss'. Moved any_email_sent() from ballot to position, and refined the criteria. - Legacy-Id: 16675 --- ietf/doc/models.py | 18 ++++++++++-------- .../templates/doc/document_ballot_content.html | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index eaa5d9c91..77cd918b0 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -1138,14 +1138,6 @@ class BallotDocEvent(DocEvent): positions.sort(key=lambda p: (p.old_ad, p.ad.last_name())) return positions - @memoize - def any_email_sent(self): - # When the send_email field is introduced, old positions will have it - # set to None. We sill essentially return True, False, or don't know: - sent_list = BallotPositionDocEvent.objects.filter(ballot=self, send_email=True).values_list('send_email', flat=True) - false = any( s==False for s in sent_list ) - true = any( s==True for s in sent_list ) - return True if true else False if false else None class BallotPositionDocEvent(DocEvent): ballot = ForeignKey(BallotDocEvent, null=True, default=None) # default=None is a temporary migration period fix, should be removed when charter branch is live @@ -1157,6 +1149,16 @@ class BallotPositionDocEvent(DocEvent): comment_time = models.DateTimeField(help_text="Time optional comment was written", blank=True, null=True) send_email = models.NullBooleanField(default=None) + @memoize + def any_email_sent(self): + # When the send_email field is introduced, old positions will have it + # set to None. We still essentially return True, False, or don't know: + sent_list = BallotPositionDocEvent.objects.filter(ballot=self.ballot, time__lte=self.time, ad=self.ad).values_list('send_email', flat=True) + false = any( s==False for s in sent_list ) + true = any( s==True for s in sent_list ) + return True if true else False if false else None + + class WriteupDocEvent(DocEvent): text = models.TextField(blank=True) diff --git a/ietf/templates/doc/document_ballot_content.html b/ietf/templates/doc/document_ballot_content.html index 3102d1707..c391598c4 100644 --- a/ietf/templates/doc/document_ballot_content.html +++ b/ietf/templates/doc/document_ballot_content.html @@ -95,9 +95,9 @@ {{ p.pos.name }} ({{ p.discuss_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %}) {% if p.send_email %} - {% elif p.ballot.any_email_sent == True %} + {% elif p.any_email_sent == True %} - {% elif p.ballot.any_email_sent == False %} + {% elif p.any_email_sent == False %} {% else %} @@ -116,9 +116,9 @@ Comment ({{ p.comment_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %}) {% if p.send_email %} - {% elif p.ballot.any_email_sent == True %} + {% elif p.any_email_sent == True %} - {% elif p.ballot.any_email_sent == False %} + {% elif p.any_email_sent == False %} {% else %}
No email
send info