Repository: ietf-tools/datatracker

Issue:
chore: remove SECR_VIRTUAL_MEETINGS setting
SECR_VIRTUAL_MEETINGS was added to settings (and used in a few code places) as a quick reaction to IETF 108. By the time we got to 109, the meeting code had adapted to being virtual, and since, to being hybrid.

The setting is no longer needed, and anything that was special about 108 should just be factored into the code.


Discussion:
ietf/secr/sreq  seems to be the only place with SECR_VIRTUAL_MEETINGS ...
tests.py:    @override_settings(SECR_VIRTUAL_MEETINGS=tuple())  # ensure not unexpectedly testing a virtual meeting session
tests.py:    @override_settings(SECR_VIRTUAL_MEETINGS=tuple())  # ensure not unexpectedly testing a virtual meeting session
views.py:    if meeting.number in settings.SECR_VIRTUAL_MEETINGS:
views.py:        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
views.py:        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
views.py:    is_virtual = meeting.number in settings.SECR_VIRTUAL_MEETINGS
views.py:        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,

Resolving patch:
diff --git a/ietf/secr/sreq/forms.py b/ietf/secr/sreq/forms.py
--- a/ietf/secr/sreq/forms.py
+++ b/ietf/secr/sreq/forms.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2013-2020, All Rights Reserved
+# Copyright The IETF Trust 2013-2022, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
@@ -19,11 +19,13 @@
 # -------------------------------------------------
 
 NUM_SESSION_CHOICES = (('','--Please select'),('1','1'),('2','2'))
-# LENGTH_SESSION_CHOICES = (('','--Please select'),('1800','30 minutes'),('3600','1 hour'),('5400','1.5 hours'), ('7200','2 hours'),('9000','2.5 hours'))
-LENGTH_SESSION_CHOICES = (('','--Please select'),('3600','60 minutes'),('7200','120 minutes'))
-VIRTUAL_LENGTH_SESSION_CHOICES = (('','--Please select'),('3000','50 minutes'),('6000','100 minutes'))
 SESSION_TIME_RELATION_CHOICES = (('', 'No preference'),) + Constraint.TIME_RELATION_CHOICES
 JOINT_FOR_SESSION_CHOICES = (('1', 'First session'), ('2', 'Second session'), ('3', 'Third session'), )
+# Used for traditional face-to-face meetings:
+# LENGTH_SESSION_CHOICES = (('','--Please select'),('1800','30 minutes'),('3600','1 hour'),('5400','1.5 hours'), ('7200','2 hours'),('9000','2.5 hours'))
+# Used for totally virtual meetings during COVID-19:
+# LENGTH_SESSION_CHOICES = (('','--Please select'),('3000','50 minutes'),('6000','100 minutes'))
+LENGTH_SESSION_CHOICES = (('','--Please select'),('3600','60 minutes'),('7200','120 minutes'))
 
 # -------------------------------------------------
 # Helper Functions
@@ -290,9 +292,12 @@ def media(self):
         return super().media + self.session_forms.media + forms.Media(js=('secr/js/session_form.js',))
 
 
-class VirtualSessionForm(SessionForm):
-    '''A SessionForm customized for special virtual meeting requirements'''
-    attendees = forms.IntegerField(required=False)
+# Used for totally virtual meetings during COVID-19 to omit the expected
+# number of attendees since there were no room size limitations
+#
+# class VirtualSessionForm(SessionForm):
+#     '''A SessionForm customized for special virtual meeting requirements'''
+#     attendees = forms.IntegerField(required=False)
 
 
 class ToolStatusForm(forms.Form):
diff --git a/ietf/secr/sreq/views.py b/ietf/secr/sreq/views.py
--- a/ietf/secr/sreq/views.py
+++ b/ietf/secr/sreq/views.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2013-2020, All Rights Reserved
+# Copyright The IETF Trust 2013-2022, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
@@ -20,7 +20,7 @@
 from ietf.meeting.utils import add_event_info_to_session_qs
 from ietf.name.models import SessionStatusName, ConstraintName
 from ietf.secr.sreq.forms import (SessionForm, ToolStatusForm, allowed_conflicting_groups,
-    JOINT_FOR_SESSION_CHOICES, VirtualSessionForm)
+    JOINT_FOR_SESSION_CHOICES)
 from ietf.secr.utils.decorators import check_permissions
 from ietf.secr.utils.group import get_my_groups
 from ietf.utils.mail import send_mail
@@ -118,13 +118,6 @@ def get_requester_text(person,group):
     if person.role_set.filter(name='secr',group__acronym='secretariat'):
         return '%s, on behalf of the %s working group' % (person.ascii, group.acronym)
 
-def get_session_form_class():
-    meeting = get_meeting(days=14)
-    if meeting.number in settings.SECR_VIRTUAL_MEETINGS:
-        return VirtualSessionForm
-    else:
-        return SessionForm
-
 def save_conflicts(group, meeting, conflicts, name):
     '''
     This function takes a Group, Meeting a string which is a list of Groups acronyms (conflicts),
@@ -285,9 +278,7 @@ def confirm(request, acronym):
     if len(group.features.session_purposes) == 0:
         raise Http404(f'Cannot request sessions for group "{acronym}"')
     meeting = get_meeting(days=14)
-    FormClass = get_session_form_class()
-
-    form = FormClass(group, meeting, request.POST, hidden=True)
+    form = SessionForm(group, meeting, request.POST, hidden=True)
     form.is_valid()
 
     login = request.user.person
@@ -392,7 +383,6 @@ def confirm(request, acronym):
 
     return render(request, 'sreq/confirm.html', {
         'form': form,
-        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
         'session': session_data,
         'group': group,
         'session_conflicts': session_conflicts},
@@ -430,7 +420,6 @@ def edit(request, acronym, num=None):
         Q(current_status__isnull=True) | ~Q(current_status__in=['canceled', 'notmeet', 'deleted'])
     ).order_by('id')
     initial = get_initial_session(sessions)
-    FormClass = get_session_form_class()
 
     if 'resources' in initial:
         initial['resources'] = [x.pk for x in initial['resources']]
@@ -455,7 +444,7 @@ def edit(request, acronym, num=None):
         if button_text == 'Cancel':
             return redirect('ietf.secr.sreq.views.view', acronym=acronym)
 
-        form = FormClass(group, meeting, request.POST, initial=initial)
+        form = SessionForm(group, meeting, request.POST, initial=initial)
         if form.is_valid():
             if form.has_changed():
                 changed_session_forms = [sf for sf in form.session_forms.forms_to_keep if sf.has_changed()]
@@ -568,11 +557,10 @@ def edit(request, acronym, num=None):
 
         if not sessions:
             return redirect('ietf.secr.sreq.views.new', acronym=acronym)
-        form = FormClass(group, meeting, initial=initial)
+        form = SessionForm(group, meeting, initial=initial)
 
     return render(request, 'sreq/edit.html', {
         'is_locked': is_locked and not has_role(request.user,'Secretariat'),
-        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
         'meeting': meeting,
         'form': form,
         'group': group,
@@ -657,8 +645,6 @@ def new(request, acronym):
         raise Http404(f'Cannot request sessions for group "{acronym}"')
     meeting = get_meeting(days=14)
     session_conflicts = dict(inbound=inbound_session_conflicts_as_string(group, meeting))
-    is_virtual = meeting.number in settings.SECR_VIRTUAL_MEETINGS
-    FormClass = get_session_form_class()
 
     # check if app is locked
     is_locked = check_app_locked()
@@ -671,7 +657,7 @@ def new(request, acronym):
         if button_text == 'Cancel':
             return redirect('ietf.secr.sreq.views.main')
 
-        form = FormClass(group, meeting, request.POST)
+        form = SessionForm(group, meeting, request.POST)
         if form.is_valid():
             return confirm(request, acronym)
 
@@ -695,16 +681,15 @@ def new(request, acronym):
         add_essential_people(group,initial)
         if 'resources' in initial:
             initial['resources'] = [x.pk for x in initial['resources']]
-        form = FormClass(group, meeting, initial=initial)
+        form = SessionForm(group, meeting, initial=initial)
 
     else:
         initial={}
         add_essential_people(group,initial)
-        form = FormClass(group, meeting, initial=initial)
+        form = SessionForm(group, meeting, initial=initial)
 
     return render(request, 'sreq/new.html', {
         'meeting': meeting,
-        'is_virtual': is_virtual,
         'form': form,
         'group': group,
         'session_conflicts': session_conflicts},
@@ -857,7 +842,6 @@ def view(request, acronym, num = None):
 
     return render(request, 'sreq/view.html', {
         'is_locked': is_locked,
-        'is_virtual': meeting.number in settings.SECR_VIRTUAL_MEETINGS,
         'session': session,  # legacy processed data
         'sessions': sessions,  # actual session instances
         'activities': activities,
diff --git a/ietf/settings.py b/ietf/settings.py
--- a/ietf/settings.py
+++ b/ietf/settings.py
@@ -1015,7 +1015,6 @@ def skip_unreadable_post(record):
 SECR_MAX_UPLOAD_SIZE = 40960000
 SECR_PROCEEDINGS_DIR = '/a/www/www6s/proceedings/'
 SECR_PPT2PDF_COMMAND = ['/usr/bin/soffice','--headless','--convert-to','pdf:writer_globaldocument_pdf_Export','--outdir']
-SECR_VIRTUAL_MEETINGS = ['108']
 STATS_REGISTRATION_ATTENDEES_JSON_URL = 'https://registration.ietf.org/{number}/attendees/'
 PROCEEDINGS_VERSION_CHANGES = [
     0,   # version 1


Test patch:
diff --git a/ietf/secr/sreq/tests.py b/ietf/secr/sreq/tests.py
--- a/ietf/secr/sreq/tests.py
+++ b/ietf/secr/sreq/tests.py
@@ -1,10 +1,9 @@
-# Copyright The IETF Trust 2013-2020, All Rights Reserved
+# Copyright The IETF Trust 2013-2022, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
 import datetime
 
-from django.test import override_settings
 from django.urls import reverse
 
 import debug                            # pyflakes:ignore
@@ -77,7 +76,6 @@ def test_cancel(self):
         self.assertRedirects(r,reverse('ietf.secr.sreq.views.main'))
         self.assertEqual(SchedulingEvent.objects.filter(session=session).order_by('-id')[0].status_id, 'deleted')
 
-    @override_settings(SECR_VIRTUAL_MEETINGS=tuple())  # ensure not unexpectedly testing a virtual meeting session
     def test_edit(self):
         meeting = MeetingFactory(type_id='ietf', date=datetime.date.today())
         mars = RoleFactory(name_id='chair', person__user__username='marschairman', group__acronym='mars').group
@@ -243,7 +241,6 @@ def test_edit(self):
         self.assertContains(r, 'First session with: {}'.format(group2.acronym))
 
 
-    @override_settings(SECR_VIRTUAL_MEETINGS=tuple())  # ensure not unexpectedly testing a virtual meeting session
     def test_edit_constraint_bethere(self):
         meeting = MeetingFactory(type_id='ietf', date=datetime.date.today())
         mars = RoleFactory(name_id='chair', person__user__username='marschairman', group__acronym='mars').group