Skip to content

Commit 02809ff

Browse files
committed
Model non-group-meeting sessions with sessions (by extending it with a
name), as a consequence, drop the "other" time slot category and remove materials on time slots - Legacy-Id: 3754
1 parent f74890a commit 02809ff

5 files changed

Lines changed: 124 additions & 85 deletions

File tree

ietf/meeting/models.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class TimeSlot(models.Model):
9191
duration = TimedeltaField()
9292
location = models.ForeignKey(Room, blank=True, null=True)
9393
show_location = models.BooleanField(default=True, help_text="Show location in agenda")
94-
materials = models.ManyToManyField(Document, blank=True)
95-
session = models.ForeignKey('Session', null=True, blank=True, help_text=u"Scheduled group session, if any")
94+
session = models.ForeignKey('Session', null=True, blank=True, help_text=u"Scheduled session, if any")
9695
modified = models.DateTimeField(default=datetime.datetime.now)
9796

9897
def __unicode__(self):
@@ -130,31 +129,25 @@ def __unicode__(self):
130129

131130
class Session(models.Model):
132131
"""Session records that a group should have a session on the
133-
meeting (the actual period of time and location is stored in
134-
TimeSlot) - if multiple timeslots are needed, multiple sessions
135-
will have to be created."""
132+
meeting (time and location is stored in a TimeSlot) - if multiple
133+
timeslots are needed, multiple sessions will have to be created.
134+
Training sessions and similar are modeled by filling in a
135+
responsible group (e.g. Edu team) and filling in the name"""
136136
meeting = models.ForeignKey(Meeting)
137+
name = models.CharField(blank=True, max_length=255, help_text="Name of session, in case the session has a purpose rather than just being a group meeting")
137138
group = models.ForeignKey(Group) # The group type determines the session type. BOFs also need to be added as a group.
138139
attendees = models.IntegerField(null=True, blank=True)
139140
agenda_note = models.CharField(blank=True, max_length=255)
140-
#
141141
requested = models.DateTimeField(default=datetime.datetime.now)
142142
requested_by = models.ForeignKey(Person)
143143
requested_duration = TimedeltaField()
144144
comments = models.TextField()
145-
#
146145
status = models.ForeignKey(SessionStatusName)
147146
scheduled = models.DateTimeField(null=True, blank=True)
148147
modified = models.DateTimeField(default=datetime.datetime.now)
149148

150-
# contains the materials while the session is being requested,
151-
# when it is scheduled, timeslot.materials should be used
152149
materials = models.ManyToManyField(Document, blank=True)
153150

154151
def __unicode__(self):
155152
timeslots = self.timeslot_set.order_by('time')
156153
return u"%s: %s %s" % (self.meeting, self.group.acronym, timeslots[0].time.strftime("%H%M") if timeslots else "(unscheduled)")
157-
158-
# IESG history is extracted from GroupHistory, rather than hand coded in a
159-
# separate table.
160-

ietf/meeting/proxy.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,12 @@ def __str__(self):
360360
return "%s at %s" % (self.acronym(), self.meeting)
361361
def agenda_file(self,interimvar=0):
362362
if not hasattr(self, '_agenda_file'):
363-
docs = self.materials.filter(type="agenda", states__type="agenda", states__slug="active")
363+
self._agenda_file = ""
364+
365+
if not self.session:
366+
return ""
367+
368+
docs = self.session.materials.filter(type="agenda", states__type="agenda", states__slug="active")
364369
if not docs:
365370
return ""
366371

@@ -371,7 +376,10 @@ def agenda_file(self,interimvar=0):
371376

372377
return self._agenda_file
373378
def minute_file(self,interimvar=0):
374-
docs = self.materials.filter(type="minutes", states__type="minutes", states__slug="active")
379+
if not self.session:
380+
return ""
381+
382+
docs = self.session.materials.filter(type="minutes", states__type="minutes", states__slug="active")
375383
if not docs:
376384
return ""
377385

@@ -404,17 +412,17 @@ class Dummy: pass
404412

405413
# from ResolveAcronym:
406414
def acronym(self):
407-
if not self.session:
408-
if self.type_id == "plenary":
409-
if "Operations and Administration" in self.name:
415+
if self.type_id == "plenary":
416+
if "Operations and Administration" in self.name:
417+
return "plenaryw"
418+
if "Technical" in self.name:
419+
return "plenaryt"
420+
for m in self.materials.filter(type="agenda", states__type="agenda", states__slug="active"):
421+
if "plenaryw" in m.name:
410422
return "plenaryw"
411-
if "Technical" in self.name:
423+
if "plenaryt" in m.name:
412424
return "plenaryt"
413-
for m in self.materials.filter(type="agenda", states__type="agenda", states__slug="active"):
414-
if "plenaryw" in m.name:
415-
return "plenaryw"
416-
if "plenaryt" in m.name:
417-
return "plenaryt"
425+
if not self.session:
418426
return "%s" % self.pk
419427
if hasattr(self, "interim"):
420428
return "i" + self.session.group.acronym
@@ -427,6 +435,8 @@ def acronym_name(self):
427435
return self.name
428436
if hasattr(self, "interim"):
429437
return self.session.group.name + " (interim)"
438+
elif self.session.name:
439+
return self.session.name
430440
else:
431441
return self.session.group.name
432442
def area(self):
@@ -510,8 +520,8 @@ def from_object(self, base):
510520
#meeting = models.ForeignKey(Meeting, db_column='meeting_num')
511521
def from_role(self, role, time):
512522
from ietf.utils.history import find_history_active_at
513-
personhistory = find_history_active_at(role.email.person, time)
514-
self.from_object(personhistory or role.email.person)
523+
personhistory = find_history_active_at(role.person, time)
524+
self.from_object(personhistory or role.person)
515525
from redesign.group.proxy import Area
516526
self.area = Area().from_object(role.group)
517527
return self

ietf/meeting/views.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
from ietf.proceedings.models import Meeting, MeetingTime, WgMeetingSession, MeetingVenue, IESGHistory, Proceeding, Switches, WgProceedingsActivities, SessionConflict
2828

29+
from redesign.group.models import Group
30+
from ietf.utils.history import find_history_active_at
31+
from redesign.doc.models import Document
32+
2933

3034
@decorator_from_middleware(GZipMiddleware)
3135
def show_html_materials(request, meeting_num=None):
@@ -141,19 +145,16 @@ def agenda_infoREDESIGN(num=None):
141145

142146
ads = []
143147
meeting_time = datetime.datetime.combine(meeting.date, datetime.time(0, 0, 0))
144-
from redesign.group.models import Group
145-
from ietf.utils.history import find_history_active_at
146148
for g in Group.objects.filter(type="area").order_by("acronym"):
147149
history = find_history_active_at(g, meeting_time)
148150
if history:
149151
if history.state_id == "active":
150-
ads.extend(IESGHistory().from_role(x, meeting_time) for x in history.rolehistory_set.filter(name="ad"))
152+
ads.extend(IESGHistory().from_role(x, meeting_time) for x in history.rolehistory_set.filter(name="ad").select_related())
151153
else:
152154
if g.state_id == "active":
153-
ads.extend(IESGHistory().from_role(x, meeting_time) for x in g.role_set.filter(name="ad"))
155+
ads.extend(IESGHistory().from_role(x, meeting_time) for x in g.role_set.filter(name="ad").select_related('group', 'person'))
154156

155-
from redesign.doc.models import Document
156-
plenary_agendas = Document.objects.filter(timeslot__meeting=meeting, timeslot__type="plenary", type="agenda").distinct()
157+
plenary_agendas = Document.objects.filter(session__meeting=meeting, session__timeslot__type="plenary", type="agenda").distinct()
157158
plenaryw_agenda = plenaryt_agenda = "The Plenary has not been scheduled"
158159
for agenda in plenary_agendas:
159160
# we use external_url at the moment, should probably regularize
@@ -165,12 +166,12 @@ def agenda_infoREDESIGN(num=None):
165166
f.close()
166167
except IOError:
167168
s = "THE AGENDA HAS NOT BEEN UPLOADED YET"
168-
169-
if "plenaryw" in agenda.name:
170-
plenaryw_agenda = s
171-
elif "plenaryt" in agenda.name:
169+
170+
if "technical" in agenda.title.lower():
172171
plenaryt_agenda = s
173-
172+
else:
173+
plenaryw_agenda = s
174+
174175
return timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda
175176

176177
if settings.USE_DB_REDESIGN_PROXY_CLASSES:

redesign/importing/import-groups.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@
106106
iana_group.type = type_names["ietf"]
107107
iana_group.save()
108108

109+
# create IEPG for use with meetings
110+
iepg_group, _ = Group.objects.get_or_create(acronym="iepg")
111+
iepg_group.name = "IEPG"
112+
iepg_group.state = state_names["active"]
113+
iepg_group.type = type_names["ietf"]
114+
iepg_group.save()
115+
116+
109117
system = Person.objects.get(name="(System)")
110118

111119
# NomCom

redesign/importing/import-meetings.py

Lines changed: 75 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
break_slot = name(TimeSlotTypeName, "break", "Break")
5555
registration_slot = name(TimeSlotTypeName, "reg", "Registration")
5656
plenary_slot = name(TimeSlotTypeName, "plenary", "Plenary")
57-
other_slot = name(TimeSlotTypeName, "other", "Other")
5857

5958
conflict_constraints = {
6059
1: name(ConstraintName, "conflict", "Conflicts with"),
@@ -171,14 +170,54 @@ def parse_time_desc(o):
171170
"4": 150 * 60,
172171
}
173172

174-
def import_materials(wg_meeting_session, timeslot=None, session=None):
175-
if timeslot:
176-
meeting = timeslot.meeting
177-
materials = timeslot.materials
178-
else:
179-
meeting = session.meeting
180-
materials = session.materials
173+
non_group_mapping = {
174+
"plenaryw": "ietf",
175+
"plenaryt": "ietf",
176+
"newcomer": "edu",
177+
"editor": "edu",
178+
"wgchair": "edu",
179+
"sectut": "edu",
180+
"protut": "edu",
181+
"iepg": "iepg",
182+
"rfc": "edu",
183+
"wgleader": "edu",
184+
"xml2rfc": "edu",
185+
"rbst": "edu",
186+
"recp": "ietf",
187+
"MIBDOC": "edu",
188+
"IE": "iepg",
189+
"newcomF": "edu",
190+
"WritRFC": "edu",
191+
"Orien": "edu",
192+
"newwork": "edu",
193+
"leadership": "edu",
194+
"ipv6spec": "edu",
195+
"Wel": "ietf",
196+
"IDRTut": "edu",
197+
"ToolsTut": "edu",
198+
"cosp": "tools",
199+
"doclife": "edu",
200+
"dnstut": "edu",
201+
"xmltut": "edu",
202+
"RFCEd": "edu",
203+
"IDRBasics": "edu",
204+
"newcomSWED": "edu",
205+
"MIBTut": "edu",
206+
"IDR75": "edu",
207+
"NewcomerJP": "edu",
208+
"MIBT": "edu",
209+
"DNSProg": "edu",
210+
"natTUT": "edu",
211+
"NewcomerCHINA": "edu",
212+
"CreatingID": "edu",
213+
"NewMeetGreet": "ietf",
214+
"appsprepmeeting": "edu",
215+
"NewcomersFrench": "edu",
216+
"NewComMandar": "edu",
217+
"AdminP": "ietf",
218+
}
181219

220+
def import_materials(wg_meeting_session, session):
182221
def import_material_kind(kind, doctype):
183222
# import agendas
184223
irtf = 0
@@ -190,44 +229,39 @@ def import_material_kind(kind, doctype):
190229
interim=0)
191230

192231
for o in found:
193-
if session:
194-
acronym = session.group.acronym
195-
else:
196-
acronym = wg_meeting_session.acronym()
197-
name = "%s-%s-%s" % (doctype.slug, meeting.number, acronym)
232+
name = "%s-%s-%s" % (doctype.slug, session.meeting.number, acronym)
198233
if kind == Slide:
199234
name += "-%s" % o.slide_num
200235

236+
if session.name:
237+
name += "-%s" % slugify(session.name)
238+
201239
name = name.lower()
202240

203241
try:
204242
d = Document.objects.get(type=doctype, docalias__name=name)
205243
except Document.DoesNotExist:
206244
d = Document(type=doctype, name=name)
207245

208-
if session:
209-
session_name = session.group.acronym.upper()
210-
else:
211-
session_name = timeslot.name
212-
213246
if kind == Slide:
214247
d.title = o.slide_name.strip()
215248
l = o.file_loc()
216249
d.external_url = l[l.find("slides/") + len("slides/"):]
217250
d.order = o.order_num or 1
218251
else:
219-
d.title = u"%s for %s at %s" % (doctype.name, session_name, meeting)
252+
session_name = session.name if session.name else session.group.acronym.upper()
253+
d.title = u"%s for %s at %s" % (doctype.name, session_name, session.meeting)
220254
d.external_url = o.filename # save filenames for now as they don't appear to be quite regular
221255
d.rev = "01"
222-
d.group = session.group if session else None
256+
d.group = session.group
223257

224258
d.save()
225259

226260
d.set_state(State.objects.get(type=doctype, slug="active"))
227261

228262
DocAlias.objects.get_or_create(document=d, name=name)
229263

230-
materials.add(d)
264+
session.materials.add(d)
231265

232266
# try to create a doc event to figure out who uploaded it
233267
t = d.type_id
@@ -258,6 +292,8 @@ def import_material_kind(kind, doctype):
258292
import_material_kind(Minute, minutes_doctype)
259293
import_material_kind(Slide, slides_doctype)
260294

295+
obviously_bogus_date = datetime.date(1970, 1, 1)
296+
261297
for o in WgMeetingSession.objects.all().order_by("pk").iterator():
262298
# num_session is unfortunately not quite reliable, seems to be
263299
# right for 1 or 2 but not 3 and it's sometimes null
@@ -302,30 +338,22 @@ def get_timeslot(attr):
302338
acronym = Acronym.objects.get(pk=o.group_acronym_id)
303339
if o.group_acronym_id < 0:
304340
# this wasn't actually a WG session, but rather a tutorial
305-
# or similar, don't create a session but instead modify
306-
# the time slot appropriately
307-
if not timeslot:
308-
print "IGNORING unscheduled non-WG-session", acronym.name
309-
continue
310-
311-
meeting_time = getattr(o, "sched_time_id%s" % i)
312-
if meeting_time.session_name_id:
313-
timeslot.name = meeting_time.session_name.session_name
314-
else:
315-
timeslot.name = acronym.name
316-
317-
if "Plenary" in timeslot.name:
318-
timeslot.type = plenary_slot
319-
else:
320-
timeslot.type = other_slot
321-
timeslot.modified = o.last_modified_date
322-
timeslot.save()
323-
324-
import_materials(o, timeslot=timeslot)
325-
326-
continue
327-
328-
s.group = Group.objects.get(acronym=acronym.acronym)
341+
# or similar
342+
a = non_group_mapping.get(acronym.acronym)
343+
if not a:
344+
a = "ietf"
345+
print "UNKNOWN phony group", o.group_acronym_id, acronym.acronym, "falling back to '%s'" % a
346+
s.group = Group.objects.get(acronym=a)
347+
s.name = acronym.name
348+
349+
if timeslot:
350+
if timeslot.name == "Unknown":
351+
timeslot.name = acronym.name
352+
353+
if "Plenary" in timeslot.name:
354+
timeslot.type = plenary_slot
355+
else:
356+
s.group = Group.objects.get(acronym=acronym.acronym)
329357
s.attendees = o.number_attendee
330358
s.agenda_note = (o.special_agenda_note or "").strip()
331359
s.requested = o.requested_date or obviously_bogus_date
@@ -340,7 +368,7 @@ def get_timeslot(attr):
340368
s.status = session_status_mapping[o.status_id or 5]
341369

342370
s.scheduled = o.scheduled_date
343-
s.modified = o.last_modified_date
371+
s.modified = o.last_modified_date or obviously_bogus_date
344372

345373
s.save()
346374

@@ -349,7 +377,7 @@ def get_timeslot(attr):
349377
timeslot.modified = s.modified
350378
timeslot.save()
351379

352-
import_materials(o, timeslot=timeslot, session=s)
380+
import_materials(o, s)
353381

354382
# some sessions have been scheduled over multiple time slots
355383
if i < 3:
@@ -358,7 +386,6 @@ def get_timeslot(attr):
358386
timeslot.session = s
359387
timeslot.modified = s.modified
360388
timeslot.save()
361-
import_materials(o, timeslot=timeslot, session=s)
362389

363390

364391
for i in (1, 2, 3):

0 commit comments

Comments
 (0)