Skip to content

Commit

Permalink
fix: restore attendee dbtemplate for old meetings pending data correc…
Browse files Browse the repository at this point in the history
…tion (#6656)

* fix: restore attendee dbtemplate for old meetings pending data correction

* test: adjust attendees test to match workaround
  • Loading branch information
rjsparks committed Nov 17, 2023
1 parent 1f47d0a commit c1627ed
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 32 deletions.
6 changes: 3 additions & 3 deletions ietf/meeting/tests_views.py
Expand Up @@ -7856,7 +7856,7 @@ def test_proceedings_attendees(self):
"""

make_meeting_test_data()
meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016, 7, 14), number="97")
meeting = MeetingFactory(type_id='ietf', date=datetime.date(2023, 11, 4), number="118")
person_a = PersonFactory(name='Person A')
person_b = PersonFactory(name='Person B')
person_c = PersonFactory(name='Person C')
Expand All @@ -7868,7 +7868,7 @@ def test_proceedings_attendees(self):
MeetingRegistrationFactory(meeting=meeting, person=person_c, reg_type='remote')
AttendedFactory(session__meeting=meeting, session__type_id='plenary', person=person_c)
MeetingRegistrationFactory(meeting=meeting, person=person_d, reg_type='remote')
url = urlreverse('ietf.meeting.views.proceedings_attendees',kwargs={'num': 97})
url = urlreverse('ietf.meeting.views.proceedings_attendees',kwargs={'num': 118})
response = self.client.get(url)
self.assertContains(response, 'Attendee list')
q = PyQuery(response.content)
Expand Down Expand Up @@ -8284,4 +8284,4 @@ def test_participants_for_meeting(self):
self.assertTrue(person_a.pk in checked_in)
self.assertTrue(person_b.pk not in checked_in)
self.assertTrue(person_c.pk in attended)
self.assertTrue(person_d.pk not in attended)
self.assertTrue(person_d.pk not in attended)
23 changes: 17 additions & 6 deletions ietf/meeting/views.py
Expand Up @@ -3861,18 +3861,29 @@ def proceedings_attendees(request, num=None):
if meeting.proceedings_format_version == 1:
return HttpResponseRedirect(f'{settings.PROCEEDINGS_V1_BASE_URL.format(meeting=meeting)}/attendee.html')

checked_in, attended = participants_for_meeting(meeting)
regs = list(MeetingRegistration.objects.filter(meeting__number=num, reg_type='onsite', checkedin=True))
template = None
meeting_registrations = None

for mr in MeetingRegistration.objects.filter(meeting__number=num, reg_type='remote').select_related('person'):
if mr.person.pk in attended and mr.person.pk not in checked_in:
regs.append(mr)
if int(meeting.number) >= 118:
checked_in, attended = participants_for_meeting(meeting)
regs = list(MeetingRegistration.objects.filter(meeting__number=num, reg_type='onsite', checkedin=True))

meeting_registrations = sorted(regs, key=lambda x: (x.last_name, x.first_name))
for mr in MeetingRegistration.objects.filter(meeting__number=num, reg_type='remote').select_related('person'):
if mr.person.pk in attended and mr.person.pk not in checked_in:
regs.append(mr)

meeting_registrations = sorted(regs, key=lambda x: (x.last_name, x.first_name))
else:
overview_template = "/meeting/proceedings/%s/attendees.html" % meeting.number
try:
template = render_to_string(overview_template, {})
except TemplateDoesNotExist:
raise Http404

return render(request, "meeting/proceedings_attendees.html", {
'meeting': meeting,
'meeting_registrations': meeting_registrations,
'template': template,
})

def proceedings_overview(request, num=None):
Expand Down
49 changes: 26 additions & 23 deletions ietf/templates/meeting/proceedings_attendees.html
Expand Up @@ -15,29 +15,32 @@ <h1>
</h1>
<h2>Attendee list of IETF {{ meeting.number }} meeting</h2>

<table id="id_attendees" class="table table-sm table-striped tablesorter">
<thead>
<tr>
<th scope="col" data-sort="last">Last Name</th>
<th scope="col" data-sort="first">First Name</th>
<th scope="col" data-sort="organization">Organization</th>
<th scope="col" data-sort="country">Country</th>
<th scope="col" data-sort="type">Registration Type</th>
</tr>
</thead>
<tbody>
{% for reg in meeting_registrations %}
<tr>
<td>{{ reg.last_name }}</td>
<td>{{ reg.first_name }}</td>
<td>{{ reg.affiliation }}</td>
<td>{{ reg.country_code }}</td>
<td>{{ reg.reg_type }}</td>
</tr>
{% endfor %}
</tbody>
</table>

{% if template %}
{{template|safe}}
{% else %}
<table id="id_attendees" class="table table-sm table-striped tablesorter">
<thead>
<tr>
<th scope="col" data-sort="last">Last Name</th>
<th scope="col" data-sort="first">First Name</th>
<th scope="col" data-sort="organization">Organization</th>
<th scope="col" data-sort="country">Country</th>
<th scope="col" data-sort="type">Registration Type</th>
</tr>
</thead>
<tbody>
{% for reg in meeting_registrations %}
<tr>
<td>{{ reg.last_name }}</td>
<td>{{ reg.first_name }}</td>
<td>{{ reg.affiliation }}</td>
<td>{{ reg.country_code }}</td>
<td>{{ reg.reg_type }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}
{% block js %}
<script src="{% static "ietf/js/list.js" %}"></script>
Expand Down

2 comments on commit c1627ed

@Khaledolaywah

This comment was marked as spam.

@yehiaelmatrwy189

This comment was marked as spam.

Please sign in to comment.