assignments on the base schedule are shown in the pages for the schedule, read-only. This allows managing things like breaks and misc sessions separately from the regular WG sessions. Base schedules are not allowed to be the base of other base schedules (the hierarchy can only be one level deep) to simplify the mental model and the code. Add link for creating new schedules instead of relying on copying Empty-Schedule and change the meeting creation code to no longer create the special Empty-Schedule. Instead a "base" schedule is created and a first schedule with the name and permissions of the user creating the meeting, using "base" as base. Speed up a couple of the Secretariat/AD agenda views by adding prefetches. - Legacy-Id: 18355
44 lines
2.2 KiB
Python
Executable file
44 lines
2.2 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# -*- Python -*-
|
|
#
|
|
|
|
import os, sys
|
|
|
|
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
|
sys.path = [ basedir ] + sys.path
|
|
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
|
|
|
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
|
if os.path.exists(virtualenv_activation):
|
|
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
|
|
|
import django
|
|
django.setup()
|
|
|
|
from ietf.group.models import Group
|
|
from ietf.person.models import Person
|
|
from ietf.name.models import SessionStatusName
|
|
from ietf.meeting.models import Meeting, Session, ScheduledSession as ScheduleTimeslotSSessionAssignment
|
|
|
|
secretariat = Group.objects.get(acronym='secretariat')
|
|
system = Person.objects.get(id=1, name='(System)')
|
|
scheduled = SessionStatusName.objects.get(slug='sched')
|
|
|
|
for meeting in Meeting.objects.filter(type="ietf").order_by("date"):
|
|
print "Checking %s schedules ..." % meeting
|
|
brk, __ = Session.objects.get_or_create(meeting=meeting, group=secretariat, requested_by=system, status=scheduled, name='Break', type_id='break',)
|
|
reg, __ = Session.objects.get_or_create(meeting=meeting, group=secretariat, requested_by=system, status=scheduled, name='Registration', type_id='reg',)
|
|
|
|
for schedule in meeting.schedule_set.all():
|
|
print " Checking for missing Break and Reg sessions in %s" % schedule
|
|
for timeslot in meeting.timeslot_set.all():
|
|
if timeslot.type_id == 'break' and not (schedule.base and SchedTimeSessAssignment.objects.filter(timeslot=timeslot, session=brk, schedule=schedule.base).exists()):
|
|
assignment, created = SchedTimeSessAssignment.objects.get_or_create(timeslot=timeslot, session=brk, schedule=schedule)
|
|
if created:
|
|
print " Added %s break assignment" % timeslot
|
|
if timeslot.type_id == 'reg' and not (schedule.base and SchedTimeSessAssignment.objects.filter(timeslot=timeslot, session=reg, schedule=schedule.base).exists()):
|
|
assignment, created = SchedTimeSessAssignment.objects.get_or_create(timeslot=timeslot, session=reg, schedule=schedule)
|
|
if created:
|
|
print " Added %s registration assignment" % timeslot
|