Skip to content

Commit 568670c

Browse files
committed
Turn sessions into regular sessions and non-sessions into misc.
sessions in the UI and code to avoid ambiguity. This doesn't change the data in the DB except for uses of TimeSlotTypeName where 'session' is now 'regular'. - Legacy-Id: 17128
1 parent 6920c17 commit 568670c

36 files changed

Lines changed: 202 additions & 160 deletions

ietf/doc/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ def test_document_material(self):
713713
meeting = Meeting.objects.get(number='72'),
714714
group = Group.objects.get(acronym='mars'),
715715
modified = datetime.datetime.now(),
716-
type_id = "session",
716+
type_id = 'regular',
717717
)
718718
SchedulingEvent.objects.create(
719719
session=session,

ietf/doc/tests_material.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_revise(self):
159159
meeting = Meeting.objects.get(number='42'),
160160
group = Group.objects.get(acronym='mars'),
161161
modified = datetime.datetime.now(),
162-
type_id="session",
162+
type_id='regular',
163163
)
164164
SchedulingEvent.objects.create(
165165
session=session,

ietf/doc/views_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ def all_presentations(request, name):
13461346
doc = get_object_or_404(Document, name=name)
13471347

13481348
sessions = add_event_info_to_session_qs(
1349-
doc.session_set.filter(type__in=['session','plenary','other'])
1349+
doc.session_set.filter(type__in=['regular','plenary','other'])
13501350
).filter(current_status__in=['sched','schedw','appr','canceled'])
13511351

13521352
status_names = {n.slug: n.name for n in SessionStatusName.objects.all()}

ietf/group/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def meetings(request, acronym=None, group_type=None):
753753
sessions = add_event_info_to_session_qs(
754754
group.session_set.filter(
755755
meeting__date__gt=four_years_ago,
756-
type__in=['session','plenary','other']
756+
type__in=['regular','plenary','other']
757757
)
758758
).filter(
759759
current_status__in=['sched','schedw','appr','canceled'],

ietf/meeting/ajax.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ def timeslot_roomurl(request, num=None, roomid=None):
161161
# no authorization required to list.
162162
def timeslot_slotlist(request, mtg):
163163
slots = mtg.timeslot_set.all()
164-
# Restrict graphical editing to slots of type 'session' for now
165-
slots = slots.filter(type__slug='session')
164+
# Restrict graphical editing to slots of type 'regular' for now
165+
slots = slots.filter(type__slug='regular')
166166
json_array=[]
167167
for slot in slots:
168168
json_array.append(slot.json_dict(request.build_absolute_uri('/')))
@@ -209,14 +209,14 @@ def timeslot_updslot(request, meeting, slotid):
209209
slot.save()
210210

211211
# WORKAROUND: Right now, if there are sessions scheduled in this timeslot
212-
# when it is marked unavailable (or any other value besides "session") they
212+
# when it is marked unavailable (or any other value besides 'regular') they
213213
# become unreachable from the editing screen. The session is listed in the
214214
# "unscheduled" block incorrectly, and drag-dropping it onto the a new
215215
# timeslot produces erroneous results. To avoid this, we will silently
216216
# unschedule any sessions in the timeslot that has just been made
217217
# unavailable.
218218

219-
if slot.type_id != 'session':
219+
if slot.type_id != 'regular':
220220
slot.sessionassignments.all().delete()
221221

222222
# ENDWORKAROUND

ietf/meeting/factories.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Meta:
8282
model = Session
8383

8484
meeting = factory.SubFactory(MeetingFactory)
85-
type_id='session'
85+
type_id='regular'
8686
group = factory.SubFactory(GroupFactory)
8787

8888
@factory.post_generation
@@ -139,7 +139,7 @@ class Meta:
139139
model = TimeSlot
140140

141141
meeting = factory.SubFactory(MeetingFactory)
142-
type_id = 'session'
142+
type_id = 'regular'
143143

144144
@factory.post_generation
145145
def location(obj, create, extracted, **kwargs): # pylint: disable=no-self-argument

ietf/meeting/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def save(self, *args, **kwargs):
245245
never gets called"""
246246
session = super(InterimSessionModelForm, self).save(commit=kwargs.get('commit', True))
247247
session.group = self.group
248-
session.type_id = 'session'
248+
session.type_id = 'regular'
249249
return session
250250

251251
def save_agenda(self):

ietf/meeting/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get_areas():
7373

7474
# get list of areas that are referenced.
7575
def get_area_list_from_sessions(assignments, num):
76-
return assignments.filter(timeslot__type = 'Session',
76+
return assignments.filter(timeslot__type = 'regular',
7777
session__group__parent__isnull = False).order_by(
7878
'session__group__parent__acronym').distinct().values_list(
7979
'session__group__parent__acronym',flat=True)
@@ -82,7 +82,7 @@ def build_all_agenda_slices(meeting):
8282
time_slices = []
8383
date_slices = {}
8484

85-
for ts in meeting.timeslot_set.filter(type__in=['session',]).order_by('time','name'):
85+
for ts in meeting.timeslot_set.filter(type__in=['regular',]).order_by('time','name'):
8686
ymd = ts.time.date()
8787

8888
if ymd not in date_slices and ts.location != None:
@@ -98,7 +98,7 @@ def build_all_agenda_slices(meeting):
9898

9999
def get_all_assignments_from_schedule(schedule):
100100
ss = schedule.assignments.filter(timeslot__location__isnull = False)
101-
ss = ss.filter(session__type__slug='session')
101+
ss = ss.filter(session__type__slug='regular')
102102
ss = ss.order_by('timeslot__time','timeslot__name')
103103

104104
return ss
@@ -107,7 +107,7 @@ def get_modified_from_assignments(assignments):
107107
return assignments.aggregate(Max('timeslot__modified'))['timeslot__modified__max']
108108

109109
def get_wg_name_list(assignments):
110-
return assignments.filter(timeslot__type = 'Session',
110+
return assignments.filter(timeslot__type = 'regular',
111111
session__group__isnull = False,
112112
session__group__parent__isnull = False).order_by(
113113
'session__group__acronym').distinct().values_list(
@@ -631,7 +631,7 @@ def update_interim_session_assignment(form):
631631
else:
632632
slot = TimeSlot.objects.create(
633633
meeting=session.meeting,
634-
type_id="session",
634+
type_id='regular',
635635
duration=session.requested_duration,
636636
time=time)
637637
SchedTimeSessAssignment.objects.create(
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright The IETF Trust 2019, All Rights Reserved
2+
# -*- coding: utf-8 -*-
3+
# Generated by Django 1.11.26 on 2019-12-06 11:13
4+
from __future__ import unicode_literals
5+
6+
from django.db import migrations
7+
8+
def rename_session_to_request(apps, schema_editor):
9+
Session = apps.get_model('meeting', 'Session')
10+
TimeSlot = apps.get_model('meeting', 'TimeSlot')
11+
Room = apps.get_model('meeting', 'Room')
12+
TimeSlotTypeName = apps.get_model('name', 'TimeSlotTypeName')
13+
14+
TimeSlotTypeName.objects.create(
15+
slug='regular',
16+
name='Regular',
17+
used=True,
18+
order=0,
19+
)
20+
21+
Session.objects.filter(type='session').update(type='regular')
22+
TimeSlot.objects.filter(type='session').update(type='regular')
23+
Room.session_types.through.objects.filter(timeslottypename='session').update(timeslottypename='regular')
24+
25+
TimeSlotTypeName.objects.filter(slug='session').delete()
26+
27+
def noop(apps, schema_editor):
28+
pass
29+
30+
class Migration(migrations.Migration):
31+
32+
dependencies = [
33+
('meeting', '0024_auto_20191204_1731'),
34+
]
35+
36+
operations = [
37+
migrations.RunPython(rename_session_to_request, noop),
38+
]

ietf/meeting/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def slug(self):
794794
components.append(g.acronym)
795795
components.append(slugify(self.session.name))
796796

797-
if self.timeslot.type_id in ('session', 'plenary'):
797+
if self.timeslot.type_id in ('regular', 'plenary'):
798798
if self.timeslot.type_id == "plenary":
799799
components.append("1plenary")
800800
else:

0 commit comments

Comments
 (0)