Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move IETF Activity reports from external text based to HTML pages #5180

Merged
merged 4 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions ietf/bin/report_id_activity

This file was deleted.

24 changes: 0 additions & 24 deletions ietf/bin/report_progress_report

This file was deleted.

8 changes: 7 additions & 1 deletion ietf/iesg/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def test_photos(self):
ads = Role.objects.filter(group__type='area', group__state='active', name_id='ad')
self.assertEqual(len(q('.photo')), ads.count())

def test_ietf_activity(self):
rjsparks marked this conversation as resolved.
Show resolved Hide resolved
url = urlreverse("ietf.iesg.views.ietf_activity")
r = self.client.get(url)
self.assertEqual(r.status_code, 200)


class IESGAgendaTests(TestCase):
def setUp(self):
super().setUp()
Expand Down Expand Up @@ -542,4 +548,4 @@ def test_reschedule(self):
self.assertTrue(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat"))
self.assertEqual(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat").telechat_date, d)
self.assertTrue(not draft.latest_event(TelechatDocEvent, "scheduled_for_telechat").returning_item)
self.assertEqual(draft.docevent_set.count(), events_before + 1)
self.assertEqual(draft.docevent_set.count(), events_before + 1)
3 changes: 2 additions & 1 deletion ietf/iesg/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
url(r'^past/documents/$', views.past_documents),
url(r'^agenda/telechat-(?:%(date)s-)?docs.tgz' % settings.URL_REGEXPS, views.telechat_docs_tarfile),
url(r'^discusses/$', views.discusses),
url(r'^ietf-activity/$', views.ietf_activity),
url(r'^milestones/$', views.milestones_needing_review),
url(r'^photos/$', views.photos),
]
]
34 changes: 33 additions & 1 deletion ietf/iesg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import os
import tarfile
import time
from dateutil import relativedelta

from django import forms
from django.conf import settings
Expand All @@ -62,6 +63,7 @@
from ietf.iesg.utils import telechat_page_count
from ietf.ietfauth.utils import has_role, role_required, user_is_person
from ietf.person.models import Person
from ietf.secr.proceedings.proc_utils import get_activity_stats
from ietf.doc.utils_search import fill_in_document_table_attributes, fill_in_telechat_date
from ietf.utils.timezone import date_today, datetime_from_date

Expand Down Expand Up @@ -528,4 +530,34 @@ def photos(request):
role.last_initial = role.person.last_name()[0]
return render(request, 'iesg/photos.html', {'group_type': 'IESG', 'role': '', 'roles': roles })


def month_choices():
choices = [(str(n).zfill(2), str(n).zfill(2)) for n in range(1, 13)]
return choices

def year_choices():
this_year = date_today().year
choices = [(str(n), str(n)) for n in range(this_year, 2009, -1)]
return choices

class ActivityForm(forms.Form):
month = forms.ChoiceField(choices=month_choices, help_text='Month', required=True)
year = forms.ChoiceField(choices=year_choices, help_text='Year', required=True)

def ietf_activity(request):
# default date range for last month
today = date_today()
edate = today.replace(day=1)
sdate = (edate - datetime.timedelta(days=1)).replace(day=1)
if request.method == 'GET':
form = ActivityForm(request.GET)
if form.is_valid():
month = form.cleaned_data['month']
year = form.cleaned_data['year']
sdate = datetime.date(int(year), int(month), 1)
edate = sdate + relativedelta.relativedelta(months=1)

# always pass back an unbound form to avoid annoying is-valid styling
form = ActivityForm(initial={'month': str(sdate.month).zfill(2), 'year': sdate.year})
context = get_activity_stats(sdate, edate)
context['form'] = form
return render(request, "iesg/ietf_activity_report.html", context)
8 changes: 4 additions & 4 deletions ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7470,7 +7470,7 @@ def test_proceedings(self):
)
self.assertNotEqual(
pq('a[href="{}"]'.format(
urlreverse('ietf.meeting.views.proceedings_progress_report', kwargs=dict(num=meeting.number)))
urlreverse('ietf.meeting.views.proceedings_activity_report', kwargs=dict(num=meeting.number)))
),
[],
'Should have a link to activity report',
Expand Down Expand Up @@ -7636,14 +7636,14 @@ def test_proceedings_overview(self, mock):
response = self.client.get(url)
self.assertContains(response, 'The Internet Engineering Task Force')

def test_proceedings_progress_report(self):
def test_proceedings_activity_report(self):
make_meeting_test_data()
rjsparks marked this conversation as resolved.
Show resolved Hide resolved
MeetingFactory(type_id='ietf', date=datetime.date(2016,4,3), number="96")
MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="97")

url = urlreverse('ietf.meeting.views.proceedings_progress_report',kwargs={'num':97})
url = urlreverse('ietf.meeting.views.proceedings_activity_report',kwargs={'num':97})
response = self.client.get(url)
self.assertContains(response, 'Progress Report')
self.assertContains(response, 'Activity Report')
rjsparks marked this conversation as resolved.
Show resolved Hide resolved

def test_feed(self):
meeting = make_meeting_test_data()
Expand Down
2 changes: 1 addition & 1 deletion ietf/meeting/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_redirect_url(self, *args, **kwargs):
url(r'^proceedings/acknowledgements/$', views.proceedings_acknowledgements),
url(r'^proceedings/attendees/$', views.proceedings_attendees),
url(r'^proceedings/overview/$', views.proceedings_overview),
url(r'^proceedings/progress-report/$', views.proceedings_progress_report),
url(r'^proceedings/activity-report/$', views.proceedings_activity_report),
url(r'^proceedings/materials/$', views_proceedings.material_details),
url(r'^proceedings/materials/(?P<material_type>[a-z_]+)/$', views_proceedings.edit_material),
url(r'^proceedings/materials/(?P<material_type>[a-z_]+)/new/$', views_proceedings.upload_material),
Expand Down
11 changes: 6 additions & 5 deletions ietf/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
from ietf.meeting.utils import new_doc_for_session, write_doc_for_session
from ietf.message.utils import infer_message
from ietf.name.models import SlideSubmissionStatusName, ProceedingsMaterialTypeName, SessionPurposeName
from ietf.secr.proceedings.proc_utils import (get_progress_stats, post_process, import_audio_files,
from ietf.secr.proceedings.proc_utils import (get_activity_stats, post_process, import_audio_files,
create_recording)
from ietf.utils import markdown
from ietf.utils.decorators import require_api_key
Expand Down Expand Up @@ -3798,18 +3798,19 @@ def proceedings_overview(request, num=None):
'template': template,
})

def proceedings_progress_report(request, num=None):
'''Display Progress Report (stats since last meeting)'''
def proceedings_activity_report(request, num=None):
'''Display Activity Report (stats since last meeting)'''
if not (num and num.isdigit()):
raise Http404
meeting = get_meeting(num)
if meeting.proceedings_format_version == 1:
return HttpResponseRedirect(f'{settings.PROCEEDINGS_V1_BASE_URL.format(meeting=meeting)}/progress-report.html')
sdate = meeting.previous_meeting().date
edate = meeting.date
context = get_progress_stats(sdate,edate)
context = get_activity_stats(sdate,edate)
context['meeting'] = meeting
return render(request, "meeting/proceedings_progress_report.html", context)
context['is_meeting_report'] = True
return render(request, "meeting/proceedings_activity_report.html", context)

class OldUploadRedirect(RedirectView):
def get_redirect_url(self, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions ietf/secr/proceedings/proc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ def send_audio_import_warning(unmatched_files):
# End Recording Functions
# -------------------------------------------------

def get_progress_stats(sdate, edate):
def get_activity_stats(sdate, edate):
'''
This function takes a date range and produces a dictionary of statistics / objects for
use in a progress report. Generally the end date will be the date of the last meeting
use in an activity report. Generally the end date will be the date of the last meeting
and the start date will be the date of the meeting before that.

Data between midnight UTC on the specified dates are included in the stats.
Expand Down
106 changes: 0 additions & 106 deletions ietf/secr/proceedings/reports.py

This file was deleted.

36 changes: 0 additions & 36 deletions ietf/secr/proceedings/tests_reports.py

This file was deleted.

21 changes: 0 additions & 21 deletions ietf/secr/templates/proceedings/report_id_activity.txt

This file was deleted.

Loading