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
This commit is contained in:
Henrik Levkowetz 2019-08-28 20:56:34 +00:00
parent 22e22c2273
commit 7ad34ba69e
2 changed files with 14 additions and 12 deletions

View file

@ -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)

View file

@ -95,9 +95,9 @@
<b>{{ p.pos.name }}</b> ({{ p.discuss_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})
{% if p.send_email %}
<span class="fa fa-envelope-o pull-right" title="Email requested to be sent for this discuss"></span>
{% elif p.ballot.any_email_sent == True %}
{% elif p.any_email_sent == True %}
<span class="fa fa-envelope pull-right" title="Email requested to be sent for earlier discuss"></span>
{% elif p.ballot.any_email_sent == False %}
{% elif p.any_email_sent == False %}
<span class="fa fa-comment-o pull-right" title="No email send requests for this discuss"></span>
{% else %}
<span class="fa fa-comment-o pull-right" title="No email send requests for this discuss"></span>
@ -116,9 +116,9 @@
<b>Comment</b> ({{ p.comment_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})
{% if p.send_email %}
<span class="fa fa-envelope-o pull-right" title="Email requested to be sent for this comment"></span>
{% elif p.ballot.any_email_sent == True %}
{% elif p.any_email_sent == True %}
<span class="fa fa-envelope pull-right" title="Email requested to be sent for earlier comment"></span>
{% elif p.ballot.any_email_sent == False %}
{% elif p.any_email_sent == False %}
<span class="fa fa-comment-o pull-right" title="No email send requests for this comment"></span>
{% else %}
<div class="pull-right small italic" style="margin-top: -0.3em;" title="No ballot position send log available">No email<br/>send info</div>