Skip to content

Commit fe82f4d

Browse files
committed
connect the new calculations to the UI. Clean flakes.
- Legacy-Id: 18974
1 parent e3476f5 commit fe82f4d

File tree

10 files changed

+27
-74
lines changed

10 files changed

+27
-74
lines changed

ietf/doc/factories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from ietf.doc.models import ( Document, DocEvent, NewRevisionDocEvent, DocAlias, State, DocumentAuthor,
1515
StateDocEvent, BallotPositionDocEvent, BallotDocEvent, BallotType, IRSGBallotDocEvent, TelechatDocEvent,
16-
DocumentActionHolder, DocumentAuthor)
16+
DocumentActionHolder)
1717
from ietf.group.models import Group
1818

1919
def draft_name_generator(type_id,group,n):

ietf/meeting/utils.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
import debug # pyflakes:ignore
1919

2020
from ietf.dbtemplate.models import DBTemplate
21-
from ietf.meeting.models import Session, Meeting, SchedulingEvent, TimeSlot, Constraint, SchedTimeSessAssignment
22-
from ietf.group.models import Group, Role
21+
from ietf.meeting.models import Session, SchedulingEvent, TimeSlot, Constraint, SchedTimeSessAssignment
22+
from ietf.group.models import Group
2323
from ietf.group.utils import can_manage_materials
2424
from ietf.name.models import SessionStatusName, ConstraintName
25-
from ietf.nomcom.utils import DISQUALIFYING_ROLE_QUERY_EXPRESSION
26-
from ietf.person.models import Person, Email
25+
from ietf.person.models import Person
2726
from ietf.secr.proceedings.proc_utils import import_audio_files
2827

2928
def session_time_for_sorting(session, use_meeting_date):
@@ -171,25 +170,6 @@ def finalize(meeting):
171170
meeting.save()
172171
return
173172

174-
def attended_ietf_meetings(person):
175-
email_addresses = Email.objects.filter(person=person).values_list('address',flat=True)
176-
return Meeting.objects.filter(
177-
type='ietf',
178-
meetingregistration__email__in=email_addresses,
179-
meetingregistration__attended=True,
180-
)
181-
182-
def attended_in_last_five_ietf_meetings(person, date=datetime.datetime.today()):
183-
previous_five = Meeting.objects.filter(type='ietf',date__lte=date).order_by('-date')[:5]
184-
attended = attended_ietf_meetings(person)
185-
return set(previous_five).intersection(attended)
186-
187-
def is_nomcom_eligible(person, date=datetime.date.today()):
188-
attended = attended_in_last_five_ietf_meetings(person, date)
189-
disqualifying_roles = Role.objects.filter(person=person).filter(DISQUALIFYING_ROLE_QUERY_EXPRESSION)
190-
return len(attended)>=3 and not disqualifying_roles.exists()
191-
192-
193173
def sort_accept_tuple(accept):
194174
tup = []
195175
if accept:

ietf/nomcom/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ def create_feedback_email(nomcom, msg):
480480
class EncryptedException(Exception):
481481
pass
482482

483+
def remove_disqualified(queryset):
484+
disqualified_roles = Role.objects.filter(DISQUALIFYING_ROLE_QUERY_EXPRESSION)
485+
return queryset.exclude(role__in=disqualified_roles)
486+
483487
def is_eligible(person, nomcom=None, date=None):
484488
return list_eligible(nomcom=nomcom, date=date, base_qs=Person.objects.filter(pk=person.pk)).exists()
485489

@@ -500,13 +504,13 @@ def list_eligible_8713(date, base_qs=None):
500504
if not base_qs:
501505
base_qs = Person.objects.all()
502506
previous_five = previous_five_meetings(date)
503-
return three_of_five_eligible(previous_five=previous_five, queryset=base_qs)
507+
return remove_disqualified(three_of_five_eligible(previous_five=previous_five, queryset=base_qs))
504508

505509
def list_eligible_8788(date, base_qs=None):
506510
if not base_qs:
507511
base_qs = Person.objects.all()
508512
previous_five = Meeting.objects.filter(number__in=['102','103','104','105','106'])
509-
return three_of_five_eligible(previous_five=previous_five, queryset=base_qs)
513+
return remove_disqualified(three_of_five_eligible(previous_five=previous_five, queryset=base_qs))
510514

511515
def list_eligible_8989(date, base_qs=None):
512516
if not base_qs:
@@ -542,12 +546,12 @@ def list_eligible_8989(date, base_qs=None):
542546
document_author_count = Count('documentauthor')
543547
).filter(document_author_count__gte=2)
544548

545-
# return three_of_five_qs.union(officer_qs, author_qs)
546-
return Person.objects.filter(pk__in=
549+
# Would be nice to use queryset union here, but the annotations make that difficult
550+
return remove_disqualified(Person.objects.filter(pk__in=
547551
set(three_of_five_qs.values_list('pk',flat=True)).union(
548552
set(officer_qs.values_list('pk',flat=True))).union(
549553
set(author_qs.values_list('pk',flat=True)))
550-
)
554+
))
551555

552556
def get_eligibility_date(nomcom=None, date=None):
553557
if date:

ietf/nomcom/views.py

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from ietf.name.models import NomineePositionStateName, FeedbackTypeName
2525
from ietf.group.models import Group, GroupEvent, Role
2626
from ietf.message.models import Message
27-
from ietf.meeting.models import Meeting
2827

2928
from ietf.nomcom.decorators import nomcom_private_key_required
3029
from ietf.nomcom.forms import (NominateForm, NominateNewPersonForm, FeedbackForm, QuestionnaireForm,
@@ -36,12 +35,11 @@
3635
from ietf.nomcom.models import (Position, NomineePosition, Nominee, Feedback, NomCom, ReminderDates,
3736
FeedbackLastSeen, Topic, TopicFeedbackLastSeen, )
3837
from ietf.nomcom.utils import (get_nomcom_by_year, store_nomcom_private_key,
39-
get_hash_nominee_position, send_reminder_to_nominees,
40-
HOME_TEMPLATE, NOMINEE_ACCEPT_REMINDER_TEMPLATE,NOMINEE_QUESTIONNAIRE_REMINDER_TEMPLATE,
41-
DISQUALIFYING_ROLE_QUERY_EXPRESSION)
38+
get_hash_nominee_position, send_reminder_to_nominees, list_eligible,
39+
HOME_TEMPLATE, NOMINEE_ACCEPT_REMINDER_TEMPLATE,NOMINEE_QUESTIONNAIRE_REMINDER_TEMPLATE, )
40+
4241
from ietf.ietfauth.utils import role_required
4342
from ietf.person.models import Person
44-
from ietf.utils import log
4543
from ietf.utils.response import permission_denied
4644

4745
import debug # pyflakes:ignore
@@ -1275,31 +1273,7 @@ def extract_email_lists(request, year):
12751273
def eligible(request, year):
12761274
nomcom = get_nomcom_by_year(year)
12771275

1278-
# This should probably be refined. If the nomcom year is this year, then
1279-
# today's date makes sense; for previous nomcoms, we should probably get
1280-
# the date of the announcement of the Call for Volunteers, instead
1281-
date = datetime.date.today()
1282-
previous_five = ( Meeting.objects.filter(type='ietf',date__lte=date)
1283-
.exclude(city='').exclude(city='Virtual')
1284-
.order_by('-date')[:5] )
1285-
log.assertion("len(previous_five) == 5")
1286-
attendees = {}
1287-
potentials = set()
1288-
for m in previous_five:
1289-
registration_emails = m.meetingregistration_set.filter(attended=True).values_list('email',flat=True)
1290-
attendees[m] = Person.objects.filter(email__address__in=registration_emails).distinct()
1291-
# See RFC8713 section 4.15
1292-
disqualified_roles = Role.objects.filter(DISQUALIFYING_ROLE_QUERY_EXPRESSION)
1293-
potentials.update(attendees[m].exclude(role__in=disqualified_roles))
1294-
eligible_persons = []
1295-
for p in potentials:
1296-
count = 0
1297-
for m in previous_five:
1298-
if p in attendees[m]:
1299-
count += 1
1300-
if count >= 3:
1301-
eligible_persons.append(p)
1302-
1276+
eligible_persons = list(list_eligible(nomcom=nomcom))
13031277
eligible_persons.sort(key=lambda p: p.last_name() )
13041278

13051279
return render(request, 'nomcom/eligible.html',

ietf/person/templatetags/person_filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
import debug # pyflakes:ignore
88

9-
from ietf.meeting.utils import is_nomcom_eligible as util_is_nomcom_eligible
9+
from ietf.nomcom.utils import is_eligible
1010
from ietf.person.models import Alias
1111

1212
register = template.Library()
1313

1414
@register.filter
1515
def is_nomcom_eligible(person, date=datetime.date.today()):
16-
return util_is_nomcom_eligible(person,date)
16+
return is_eligible(person=person,date=date)
1717

1818
@register.filter
1919
def person_by_name(name):

ietf/stats/management/commands/find_meetingregistration_person_issues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import debug # pyflakes:ignore
44

5-
from django.core.management.base import BaseCommand, CommandError
5+
from django.core.management.base import BaseCommand
66

77
from ietf.stats.utils import find_meetingregistration_person_issues
88

ietf/stats/management/commands/repair_meetingregistration_person.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import debug # pyflakes:ignore
44

5-
from django.core.management.base import BaseCommand, CommandError
5+
from django.core.management.base import BaseCommand
66

77
from ietf.stats.utils import repair_meetingregistration_person
88

ietf/stats/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import requests
77
from collections import defaultdict
88

9-
from django.db.models import F, Q
109
from django.conf import settings
1110
from django.contrib.auth.models import User
1211

ietf/templates/nomcom/eligible.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
{% origin %}
1515
<h2>Eligible People for {{ nomcom.group }}</h2>
1616

17-
<p class="alert alert-info">
18-
This calculation is experimental and is likely wrong. Check carefully against the secretariat eligibility tools if it matters. This page lists people who would be nomcom eligible if the selection were made <em>today</em>. Thus if today is not between the spring and summer IETF meetings, the list won't reflect eligibility at the time actual selections will be made.
19-
</p>
2017
<table class="table table-condensed table-striped tablesorter">
2118
<thead>
2219
<th>Last Name</th>

ietf/templates/registration/edit_profile.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,16 @@ <h1>Profile information for {{ user.person.name }}</h1>
6969
<div class="col-sm-1 form-control-static">{{person|is_nomcom_eligible|yesno:'Yes,No,No'}}</div>
7070
<div class="col-sm-9">
7171
<p class="alert alert-info form-control-static">
72-
This calculation is EXPERIMENTAL.<br/>
73-
74-
If you believe it is incorrect, make sure you've added all the
72+
If you believe this calculation is incorrect, make sure you've added all the
7573
email addresses you've registered for IETF meetings with to the
7674
list below.<br/>
7775

7876
If you've done so and the calculation is still incorrect, please
7977
send a note to
80-
<a href="mailto:{{settings.SECRETARIAT_INFO_EMAIL}}">{{settings.SECRETARIAT_INFO_EMAIL}}</a>.<br/>
81-
See <a href="{% url 'ietf.doc.views_doc.document_main' name='rfc7437'%}">RFC 7437</a>
82-
for eligibility requirements.
78+
<a href="mailto:{{settings.SECRETARIAT_SUPPORT_EMAIL}}">{{settings.SECRETARIAT_SUPPORT_EMAIL}}</a>.<br/>
79+
See <a href="{% url 'ietf.doc.views_doc.document_main' name='rfc8713'%}">RFC 8713</a>
80+
for eligibility requirements.
81+
For the 2021 nomcom, see also <a href="{% url 'ietf.doc.views_doc.document_main' name='rfc8989' %}">RFC 8989</a>.
8382

8483
</p>
8584
</div>
@@ -181,7 +180,7 @@ <h1>Profile information for {{ user.person.name }}</h1>
181180
dagger symbol (<strong>&dagger;</strong>) next to it, or listed on your
182181
<a href="{% url 'ietf.community.views.view_list' user.username %}">notification subscription page</a>. Most of this
183182
information can be edited or removed on these pages. There are some exceptions, such
184-
as photos, which currently require an email to <a href="mailto:{{settings.SECRETARIAT_INFO_EMAIL}}">the Secretariat</a>
183+
as photos, which currently require an email to <a href="mailto:{{settings.SECRETARIAT_SUPPORT_EMAIL}}">the Secretariat</a>
185184
if you wish to update or remove the information.
186185

187186
</p>

0 commit comments

Comments
 (0)