Added an is_bof flag to json_agenda. Also added group state information. Changed the group information to use historic information instead of current.

- Legacy-Id: 12009
This commit is contained in:
Henrik Levkowetz 2016-09-20 20:28:22 +00:00
parent fe0bc55632
commit e553ff80d8
2 changed files with 19 additions and 12 deletions

View file

@ -56,6 +56,9 @@ class GroupInfo(models.Model):
def interim_approval_roles(self):
return list(set([ role for role in self.parent.role_set.filter(name__in=['ad', 'chair']) ]))
def is_bof(self):
return (self.state.slug in ["bof", "bof-conc"])
class Meta:
abstract = True
@ -91,9 +94,6 @@ class Group(GroupInfo):
p = p.parent
return False
def is_bof(self):
return (self.state.slug in ["bof", "bof-conc"])
def get_chair(self):
chair = self.role_set.filter(name__slug='chair')[:1]
return chair and chair[0] or None

View file

@ -902,25 +902,32 @@ def json_agenda(request, num=None ):
sessions = []
room_names = set()
parent_acronyms = set()
for asgn in meeting.agenda.assignments.exclude(session__type__in=['lead','offagenda','break','reg']):
assignments = meeting.agenda.assignments.exclude(session__type__in=['lead','offagenda','break','reg'])
# Update the assignments with historic information, i.e., valid at the
# time of the meeting
assignments = preprocess_assignments_for_agenda(assignments, meeting)
for asgn in assignments:
sessdict = dict()
sessdict['objtype'] = 'session'
sessdict['id'] = asgn.pk
if asgn.session.group:
if asgn.session.historic_group:
sessdict['group'] = {
"acronym": asgn.session.group.acronym,
"name": asgn.session.group.name,
"type": asgn.session.group.type_id,
"acronym": asgn.session.historic_group.acronym,
"name": asgn.session.historic_group.name,
"type": asgn.session.historic_group.type_id,
"state": asgn.session.historic_group.state_id,
}
if asgn.session.group.type_id in ['wg','rg', 'ag',] or asgn.session.group.acronym in ['iesg',]:
sessdict['group']['parent'] = asgn.session.group.parent.acronym
parent_acronyms.add(asgn.session.group.parent.acronym)
if asgn.session.historic_group.is_bof():
sessdict['is_bof'] = True
if asgn.session.historic_group.type_id in ['wg','rg', 'ag',] or asgn.session.historic_group.acronym in ['iesg',]:
sessdict['group']['parent'] = asgn.session.historic_group.historic_parent.acronym
parent_acronyms.add(asgn.session.historic_group.historic_parent.acronym)
if asgn.session.name:
sessdict['name'] = asgn.session.name
elif asgn.session.short:
sessdict['name'] = asgn.session.short
else:
sessdict['name'] = asgn.session.group.name
sessdict['name'] = asgn.session.historic_group.name
sessdict['start'] = asgn.timeslot.utc_start_time().strftime("%Y-%m-%dT%H:%M:%SZ")
sessdict['duration'] = str(asgn.timeslot.duration)
sessdict['location'] = asgn.room_name