diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index 93839fd34..ffab9a482 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -867,6 +867,13 @@ class Constraint(models.Model): if self.target is not None: ct1['target_href'] = urljoin(host_scheme, self.target.json_url()) ct1['meeting_href'] = urljoin(host_scheme, self.meeting.json_url()) + if self.time_relation: + ct1['time_relation'] = self.time_relation + ct1['time_relation_display'] = self.get_time_relation_display() + if self.timeranges.count(): + ct1['timeranges_cant_meet'] = [t.slug for t in self.timeranges.all()] + timeranges_str = ", ".join([t.desc for t in self.timeranges.all()]) + ct1['timeranges_display'] = "Can't meet %s" % timeranges_str return ct1 @@ -1122,6 +1129,7 @@ class Session(models.Model): sess1['bof'] = str(self.group.is_bof()) sess1['agenda_note'] = self.agenda_note sess1['attendees'] = str(self.attendees) + sess1['joint_with_groups'] = self.joint_with_groups_acronyms() # fish out scheduling information - eventually, we should pick # this out in the caller instead diff --git a/ietf/meeting/tests_api.py b/ietf/meeting/tests_api.py index 5840e5ea7..5ffc16d77 100644 --- a/ietf/meeting/tests_api.py +++ b/ietf/meeting/tests_api.py @@ -1,4 +1,4 @@ -# Copyright The IETF Trust 2013-2019, All Rights Reserved +# Copyright The IETF Trust 2013-2020, All Rights Reserved # -*- coding: utf-8 -*- @@ -12,6 +12,7 @@ from django.urls import reverse as urlreverse import debug # pyflakes:ignore +from ietf.name.models import TimerangeName from ietf.group.models import Group from ietf.meeting.models import Schedule, TimeSlot, Session, SchedTimeSessAssignment, Meeting, Constraint from ietf.meeting.test_data import make_meeting_test_data @@ -119,10 +120,23 @@ class ApiTests(TestCase): person=Person.objects.get(user__username="ad"), name_id="bethere") + c_adjacent = Constraint.objects.create(meeting=meeting, source=session.group, + target=Group.objects.get(acronym="irg"), + name_id="wg_adjacent") + + c_time_relation = Constraint.objects.create(meeting=meeting, source=session.group, + time_relation='subsequent-days', + name_id="time_relation") + + c_timerange = Constraint.objects.create(meeting=meeting, source=session.group, + name_id="timerange") + c_timerange.timeranges.set(TimerangeName.objects.filter(slug__startswith='monday')) + r = self.client.get(urlreverse("ietf.meeting.ajax.session_constraints", kwargs=dict(num=meeting.number, sessionid=session.pk))) self.assertEqual(r.status_code, 200) constraints = r.json() - self.assertEqual(set([c_ames.pk, c_person.pk]), set(c["constraint_id"] for c in constraints)) + expected_keys = set([c_ames.pk, c_person.pk, c_adjacent.pk, c_time_relation.pk, c_timerange.pk]) + self.assertEqual(expected_keys, set(c["constraint_id"] for c in constraints)) def test_meeting_json(self): meeting = make_meeting_test_data() diff --git a/ietf/static/ietf/js/agenda/agenda_objects.js b/ietf/static/ietf/js/agenda/agenda_objects.js index 0dfb480c8..0b42aee30 100644 --- a/ietf/static/ietf/js/agenda/agenda_objects.js +++ b/ietf/static/ietf/js/agenda/agenda_objects.js @@ -1225,12 +1225,30 @@ Session.prototype.generate_info_table = function() { if(!read_only) { $("#info_location").html(generate_select_box()+""); } - - if("comments" in this && this.comments.length > 0 && this.comments != "None") { - $("#special_requests").text(this.comments); - } else { - $("#special_requests").text("Special requests: None"); + + var special_requests_text = ''; + if(this.joint_with_groups) { + special_requests_text += 'Joint session with ' + this.joint_with_groups.join(', ') + '. '; } + if(this.constraints.wg_adjacent) { + for (var target_href in this.constraints.wg_adjacent) { + if (this.constraints.wg_adjacent.hasOwnProperty(target_href)) { + special_requests_text += 'Schedule adjacent with ' + this.constraints.wg_adjacent[target_href].othergroup.acronym + '. '; + } + } + } + if(this.constraints.time_relation) { + special_requests_text += this.constraints.time_relation.time_relation.time_relation_display + '. '; + } + if(this.constraints.timerange) { + special_requests_text += this.constraints.timerange.timerange.timeranges_display + '. '; + } + if("comments" in this && this.comments.length > 0 && this.comments != "None") { + special_requests_text += this.comments; + } else { + special_requests_text += "Special requests: None"; + } + $("#special_requests").text(special_requests_text); this.selectit(); @@ -1721,13 +1739,17 @@ Session.prototype.add_constraint_obj = function(obj) { obj.person = person; }); } else { - // must be conflic* + // must be conflic*, timerange, time_relation or wg_adjacent var ogroupname; if(obj.source_href == this.group_href) { obj.thisgroup = this.group; obj.othergroup = find_group_by_href(obj.target_href, "constraint src"+obj.href); obj.direction = 'ours'; - ogroupname = obj.target_href; + if (obj.target_href) { + ogroupname = obj.target_href; + } else { + ogroupname = obj.name; + } if(this.constraints[listname][ogroupname]) { console.log("Found multiple instances of",this.group_href,listname,ogroupname); }