Repository: ietf-tools/datatracker

Issue:
Remove secretariat room-view from the meeting agenda
This view is currently broken, and its current javascript doesn't look like a good place to start for repairs.

The secretariat is not using the tab. It was created to help avoid the need for a similar view maintained in a separate spreadsheet/google doc. We should visit with the secretariat again about what the requirements for the view really are.


Discussion:

Resolving patch:
diff --git a/ietf/meeting/urls.py b/ietf/meeting/urls.py
--- a/ietf/meeting/urls.py
+++ b/ietf/meeting/urls.py
@@ -34,7 +34,6 @@
     url(r'^agenda/%(owner)s/%(schedule_name)s/make_official$' % settings.URL_REGEXPS, views.make_schedule_official),
     url(r'^agenda/%(owner)s/%(schedule_name)s(\.(?P<ext>.html))?/?$' % settings.URL_REGEXPS, views.agenda),
     url(r'^agenda/%(owner)s/%(schedule_name)s/week-view(?:.html)?/?$' % settings.URL_REGEXPS, views.week_view),
-    url(r'^agenda/%(owner)s/%(schedule_name)s/room-view(?:.html)?/?$' % settings.URL_REGEXPS, views.room_view),
     url(r'^agenda/%(owner)s/%(schedule_name)s/by-room/?$' % settings.URL_REGEXPS, views.agenda_by_room),
     url(r'^agenda/%(owner)s/%(schedule_name)s/by-type/?$' % settings.URL_REGEXPS, views.agenda_by_type),
     url(r'^agenda/%(owner)s/%(schedule_name)s/by-type/(?P<type>[a-z]+)$' % settings.URL_REGEXPS, views.agenda_by_type),
@@ -77,11 +76,9 @@
     url(r'^agenda\.ics$', views.agenda_ical),
     url(r'^agenda.json$', views.agenda_json),
     url(r'^agenda/week-view(?:.html)?/?$', views.week_view),
-    url(r'^agenda/room-view(?:.html)?/?$', views.room_view),
     url(r'^floor-plan/?$', views.floor_plan),
     url(r'^floor-plan/(?P<floor>[-a-z0-9_]+)/?$', views.floor_plan),
     url(r'^week-view(?:.html)?/?$', views.week_view),
-    url(r'^room-view(?:.html)?/?$', views.room_view),
     url(r'^materials(?:.html)?/?$', views.materials),
     url(r'^request_minutes/?$', views.request_minutes),
     url(r'^materials/%(document)s((?P<ext>\.[a-z0-9]+)|/)?$' % settings.URL_REGEXPS, views.materials_document),
diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py
--- a/ietf/meeting/views.py
+++ b/ietf/meeting/views.py
@@ -32,7 +32,7 @@
 from django.core.exceptions import ValidationError
 from django.core.validators import URLValidator
 from django.urls import reverse,reverse_lazy
-from django.db.models import F, Min, Max, Q
+from django.db.models import F, Max, Q
 from django.forms.models import modelform_factory, inlineformset_factory
 from django.template import TemplateDoesNotExist
 from django.template.loader import render_to_string
@@ -1906,69 +1906,6 @@ def week_view(request, num=None, name=None, owner=None):
         "items": json.dumps(items),
     })
 
-@role_required('Area Director','Secretariat','IAB')
-def room_view(request, num=None, name=None, owner=None):
-    meeting = get_meeting(num)
-
-    rooms = meeting.room_set.order_by('functional_name','name')
-    if not rooms.exists():
-        return HttpResponse("No rooms defined yet")
-
-    if name is None:
-        schedule = get_schedule(meeting)
-    else:
-        person   = get_person_by_email(owner)
-        schedule = get_schedule_by_name(meeting, person, name)
-
-    assignments = SchedTimeSessAssignment.objects.filter(
-        schedule__in=[schedule, schedule.base if schedule else None]
-    ).prefetch_related(
-        'timeslot', 'timeslot__location', 'session', 'session__group', 'session__group__parent'
-    )
-    unavailable = meeting.timeslot_set.filter(type__slug='unavail')
-    if not (assignments.exists() or unavailable.exists()):
-        return HttpResponse("No sessions/timeslots available yet")
-
-    earliest = None
-    latest = None
-
-    if assignments:
-        earliest = assignments.aggregate(Min('timeslot__time'))['timeslot__time__min']
-        latest =  assignments.aggregate(Max('timeslot__time'))['timeslot__time__max']
-        
-    if unavailable:
-        earliest_unavailable = unavailable.aggregate(Min('time'))['time__min']
-        if not earliest or ( earliest_unavailable and earliest_unavailable < earliest ):
-            earliest = earliest_unavailable
-        latest_unavailable = unavailable.aggregate(Max('time'))['time__max']
-        if not latest or ( latest_unavailable and latest_unavailable > latest ):
-            latest = latest_unavailable
-
-    if not (earliest and latest):
-        raise Http404
-
-    base_time = earliest
-    base_day = datetime.datetime(base_time.year,base_time.month,base_time.day)
-
-    day = base_day
-    days = []
-    while day <= latest :
-        days.append(day)
-        day += datetime.timedelta(days=1)
-
-    unavailable = list(unavailable)
-    for t in unavailable:
-        t.delta_from_beginning = (t.time - base_time).total_seconds()
-        t.day = (t.time-base_day).days
-
-    assignments = list(assignments)
-    for ss in assignments:
-        ss.delta_from_beginning = (ss.timeslot.time - base_time).total_seconds()
-        ss.day = (ss.timeslot.time-base_day).days
-
-    template = "meeting/room-view.html"
-    return render(request, template,{"meeting":meeting,"schedule":schedule,"unavailable":unavailable,"assignments":assignments,"rooms":rooms,"days":days})
-
 def ical_session_status(assignment):
     if assignment.session.current_status == 'canceled':
         return "CANCELLED"


Test patch:
diff --git a/ietf/meeting/tests_views.py b/ietf/meeting/tests_views.py
--- a/ietf/meeting/tests_views.py
+++ b/ietf/meeting/tests_views.py
@@ -438,18 +438,6 @@ def test_agenda_by_type(self):
         r = self.client.get(url)
         self.assertFalse(any([x in unicontent(r) for x in ['IESG Breakfast','Breakfast Room']]))
 
-    def test_agenda_room_view(self):
-        meeting = make_meeting_test_data()
-        url = urlreverse("ietf.meeting.views.room_view",kwargs=dict(num=meeting.number))
-        login_testing_unauthorized(self,"secretary",url)
-        r = self.client.get(url)
-        self.assertEqual(r.status_code,200)
-        self.assertTrue(all([x in unicontent(r) for x in ['mars','IESG Breakfast','Test Room','Breakfast Room']]))
-        url = urlreverse("ietf.meeting.views.room_view",kwargs=dict(num=meeting.number,name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email()))
-        r = self.client.get(url)
-        self.assertTrue(all([x in unicontent(r) for x in ['mars','Test Room','Breakfast Room']]))
-        self.assertNotContains(r, 'IESG Breakfast')
-
 
     def test_agenda_week_view(self):
         meeting = make_meeting_test_data()