If the announcement hasn't been sent, then use the "old"

algorithm of displaying the current IESG with empty positions
for those that haven't been cast yet; if it has been sent
then just list the actual positions that are recorded since
the database doesn't have any record of whether the positions
were for current or old ADs.
 - Legacy-Id: 636
This commit is contained in:
Bill Fenner 2007-06-25 17:41:50 +00:00
parent 6ca9b6f451
commit 5ed1f62f35
2 changed files with 19 additions and 1 deletions

View file

@ -259,6 +259,11 @@ class IESGLogin(models.Model):
def __str__(self):
#return "%s, %s" % ( self.last_name, self.first_name)
return "%s %s" % ( self.first_name, self.last_name)
def is_current_ad(self):
return self.user_level == 1
def active_iesg():
return IESGLogin.objects.filter(user_level=1,id__gt=1).order_by('last_name') #XXX hardcoded
active_iesg = staticmethod(active_iesg)
class Meta:
db_table = 'iesg_login'
class Admin:
@ -416,6 +421,17 @@ class BallotInfo(models.Model): # Added by Michael Lee
def remarks(self):
remarks = list(self.discusses.all()) + list(self.comments.all())
return remarks
def active_positions(self):
'''Returns a list of dicts, with AD and Position tuples'''
active_iesg = IESGLogin.active_iesg()
ads = [ad.id for ad in active_iesg]
positions = {}
for position in self.positions.filter(ad__in=ads):
positions[position.ad_id] = position
ret = []
for ad in active_iesg:
ret.append({'ad': ad, 'pos': positions.get(ad.id, None)})
return ret
class Meta:
db_table = 'ballot_info'
class Admin:

View file

@ -20,8 +20,10 @@ Last Call to expire on: {{ object.drafts.all.0.draft.lc_expiration_date|escape }
Please return the full line with your position.
Yes No-Objection Discuss Abstain
{% for position in object.positions.all|dictsort:"ad.last_name" %}{{ position.ad|ljust:"20" }} {{ position.yes|bracket }} {{ position.noobj|bracket }} {{ position.discuss|bracket }} {{ position.abstain_ind|bracket }}
{% if not object.an_sent %}{% for curpos in object.active_positions %}{{ curpos.ad|ljust:"20" }} {{ curpos.pos.yes|bracket }} {{ curpos.pos.noobj|bracket }} {{ curpos.pos.discuss|bracket }} {{ curpos.pos.abstain_ind|bracket }}
{% endfor %}
{% endif %}{% for position in object.positions.all|dictsort:"ad.last_name" %}{% if object.an_sent or not position.ad.is_current_ad %}{{ position.ad|ljust:"20" }} {{ position.yes|bracket }} {{ position.noobj|bracket }} {{ position.discuss|bracket }} {{ position.abstain_ind|bracket }}
{% endif %}{% endfor %}
"Yes" or "No-Objection" positions from 2/3 of non-recused ADs,
with no "Discuss" positions, are needed for approval.