Add a page for the nomcom-chair and the secretariat to view who the datatracker thinks is nomcom eligible. Related to #2257. Commit ready for merge.

- Legacy-Id: 14533
This commit is contained in:
Robert Sparks 2018-01-17 17:58:58 +00:00
parent ae16217900
commit 4ce6b934b8
5 changed files with 77 additions and 0 deletions

View file

@ -1749,6 +1749,12 @@ Junk body for testing
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_eligible(self):
url = reverse('ietf.nomcom.views.eligible',kwargs={'year':self.nc.year()})
login_testing_unauthorized(self,self.chair.user.username,url)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
class NomComIndexTests(TestCase):
def setUp(self):

View file

@ -36,6 +36,7 @@ urlpatterns = [
url(r'^(?P<year>\d{4})/private/chair/topic/add/$', views.edit_topic),
url(r'^(?P<year>\d{4})/private/chair/topic/(?P<topic_id>\d+)/$', views.edit_topic),
url(r'^(?P<year>\d{4})/private/chair/topic/(?P<topic_id>\d+)/remove/$', views.remove_topic),
url(r'^(?P<year>\d{4})/private/chair/eligible/$', views.eligible ),
url(r'^(?P<year>\d{4})/$', views.year_index),
url(r'^(?P<year>\d{4})/requirements/$', views.requirements),

View file

@ -18,6 +18,7 @@ from ietf.dbtemplate.views import template_edit, template_show
from ietf.name.models import NomineePositionStateName, FeedbackTypeName
from ietf.group.models import Group, GroupEvent
from ietf.message.models import Message
from ietf.meeting.models import Meeting
from ietf.nomcom.decorators import nomcom_private_key_required
from ietf.nomcom.forms import (NominateForm, NominateNewPersonForm, FeedbackForm, QuestionnaireForm,
@ -1223,3 +1224,32 @@ def extract_email_lists(request, year):
'noresp': noresp,
'bypos': bypos,
})
@role_required("Nomcom Chair", "Nomcom Advisor", "Secretariat")
def eligible(request, year):
nomcom = get_nomcom_by_year(year)
date = datetime.date.today()
previous_five = Meeting.objects.filter(type='ietf',date__lte=date).order_by('-date')[:5]
attendees = {}
potentials = set()
for m in previous_five:
registration_emails = m.meetingregistration_set.values_list('email',flat=True)
attendees[m] = Person.objects.filter(email__address__in=registration_emails).distinct()
potentials.update(attendees[m].exclude(role__group__type_id='area',role__group__state='active',role__name_id='ad').exclude(role__group__acronym='iab',role__name_id__in=['member','chair']).exclude(role__group__acronym='iaoc',role__name_id__in=['member','chair']))
eligible_persons = []
for p in potentials:
count = 0
for m in previous_five:
if p in attendees[m]:
count += 1
if count >= 3:
eligible_persons.append(p)
eligible_persons.sort(key=lambda p: p.last_name() )
return render(request, 'nomcom/eligible.html',
{'nomcom':nomcom,
'year':year,
'eligible_persons':eligible_persons,
})

View file

@ -0,0 +1,39 @@
{% extends "nomcom/nomcom_private_base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load bootstrap3 %}
{% load staticfiles %}
{% block subtitle %} - Eligible People{% endblock %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
{% endblock %}
{% block nomcom_content %}
{% origin %}
<h2>Eligible People for {{ nomcom.group }}</h2>
<p class="alert alert-info">
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.
</p>
<table class="table table-condensed table-striped tablesorter">
<thead>
<th>Last Name</th>
<th>First Name</th>
<th>Email Addresses</th>
</thead>
{% for p in eligible_persons %}
<tr>
<td><a href="{% url 'ietf.person.views.profile' p.plain_name %}">{{p.last_name}}</a></td>
<td>{{p.first_name}}</td>
<td>{% for e in p.email_set.all %}{{e.address}}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</table>
{% endblock nomcom_content %}
{% block js %}
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
{% endblock %}

View file

@ -45,6 +45,7 @@
{% if nomcom.group.state_id == 'active' %}
<li {% if selected == "edit_members" %}class="active"{% endif %}><a href="{% url 'ietf.nomcom.views.edit_members' year %}">Edit Members</a></li>
{% endif %}
<li {% if selected == "view_eligible" %}class="active"{% endif %}><a href="{% url 'ietf.nomcom.views.eligible' year %}">View Eligible</a></li>
<li {% if selected == "help" %}class="active"{% endif %}><a href="{% url 'ietf.nomcom.views.configuration_help' year %}">Configuration Help</a></li>
<li role="presentation" class="dropdown-header">Other Tools</li>
<li {% if selected == "announce" %}class="active"{% endif %}><a href="{% url 'ietf.secr.announcement.views.main'%}">Announcement Tool</a></li>