feat: Easy extraction of qualified volunteer list for nomcom chair (#5578)
* feat: Easy extraction of qualified volunteer list for nomcom chair * fix: tune test setup to years where eligibility calculations can return nonempty * chore: revert unintended change * feat: default string when no affiliation is provided
This commit is contained in:
parent
3af357467c
commit
3bbd5149de
|
@ -1489,7 +1489,10 @@ class NewActiveNomComTests(TestCase):
|
|||
def setUp(self):
|
||||
super().setUp()
|
||||
setup_test_public_keys_dir(self)
|
||||
self.nc = NomComFactory.create(**nomcom_kwargs_for_year(year=random.randint(1992,2100)))
|
||||
# Pin nomcom years to be after 2008 or later so that ietf.nomcom.utils.list_eligible can
|
||||
# return something other than empty. Note that anything after 2022 is suspect, and that
|
||||
# we should revisit this when implementing RFC 9389.
|
||||
self.nc = NomComFactory.create(**nomcom_kwargs_for_year(year=random.randint(2008,2100)))
|
||||
self.chair = self.nc.group.role_set.filter(name='chair').first().person
|
||||
self.saved_days_to_expire_nomination_link = settings.DAYS_TO_EXPIRE_NOMINATION_LINK
|
||||
|
||||
|
@ -1929,7 +1932,7 @@ Junk body for testing
|
|||
for number in range(meeting_start, meeting_start+8):
|
||||
m = MeetingFactory.create(type_id='ietf', number=number)
|
||||
for p in people:
|
||||
m.meetingregistration_set.create(person=p)
|
||||
m.meetingregistration_set.create(person=p, reg_type="onsite", checkedin=True, attended=True)
|
||||
for p in people:
|
||||
self.nc.volunteer_set.create(person=p,affiliation='something')
|
||||
for view in ('public_volunteers','private_volunteers'):
|
||||
|
@ -1947,6 +1950,14 @@ Junk body for testing
|
|||
login_testing_unauthorized(self,self.chair.user.username,url)
|
||||
response = self.client.get(url)
|
||||
self.assertContains(response,people[-1].email(),status_code=200)
|
||||
unqualified_person = PersonFactory()
|
||||
url = reverse('ietf.nomcom.views.qualified_volunteer_list_for_announcement',kwargs={'year':year})
|
||||
self.client.logout()
|
||||
login_testing_unauthorized(self,self.chair.user.username,url)
|
||||
response = self.client.get(url)
|
||||
self.assertContains(response, people[-1].plain_name(), status_code=200)
|
||||
self.assertNotContains(response, unqualified_person.plain_name())
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ urlpatterns = [
|
|||
url(r'^(?P<year>\d{4})/private/chair/eligible/$', views.private_eligible),
|
||||
url(r'^(?P<year>\d{4})/private/chair/volunteers/$', views.private_volunteers),
|
||||
url(r'^(?P<year>\d{4})/private/chair/volunteers/csv/$', views.private_volunteers_csv),
|
||||
url(r'^(?P<year>\d{4})/private/chair/volunteers/announce-list/$', views.qualified_volunteer_list_for_announcement),
|
||||
|
||||
url(r'^(?P<year>\d{4})/$', views.year_index),
|
||||
url(r'^(?P<year>\d{4})/requirements/$', views.requirements),
|
||||
|
|
|
@ -1333,3 +1333,12 @@ def private_volunteers_csv(request, year, public=False):
|
|||
writer.writerow([v.person.last_name(), v.person.first_name(), v.person.ascii_name(), v.affiliation, v.person.email(), v.qualifications, v.eligible])
|
||||
return response
|
||||
|
||||
@role_required("Nomcom Chair", "Nomcom Advisor", "Secretariat")
|
||||
def qualified_volunteer_list_for_announcement(request, year, public=False):
|
||||
_, volunteers = extract_volunteers(year)
|
||||
qualified_volunteers = [v for v in volunteers if v.eligible]
|
||||
return render(request, 'nomcom/qualified_volunteer_list_for_announcement.txt',
|
||||
dict(volunteers=qualified_volunteers),
|
||||
content_type="text/plain; charset=%s"%settings.DEFAULT_CHARSET)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{% load ietf_filters %}{% autoescape off %}Name Affiliation
|
||||
|
||||
{% for volunteer in volunteers %}{{ volunteer.person.plain_name|ljust:"25" }}{{ volunteer.affiliation|default:"No affiliation provided" }}
|
||||
{% endfor %}{% endautoescape %}
|
Loading…
Reference in a new issue