Skip to content

Commit 4decb23

Browse files
author
Sasha Romijn
committed
Add display of new constraints and joint sessions to agenda builder interface.
The new timerange, time_relation and wg_adjacent constraints, along with the joint_with_groups option, are now reflected in the special requests field. This allows them to be taken into account while scheduling sessions. - Legacy-Id: 17378
1 parent e705791 commit 4decb23

3 files changed

Lines changed: 51 additions & 7 deletions

File tree

ietf/meeting/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,13 @@ def json_dict(self, host_scheme):
867867
if self.target is not None:
868868
ct1['target_href'] = urljoin(host_scheme, self.target.json_url())
869869
ct1['meeting_href'] = urljoin(host_scheme, self.meeting.json_url())
870+
if self.time_relation:
871+
ct1['time_relation'] = self.time_relation
872+
ct1['time_relation_display'] = self.get_time_relation_display()
873+
if self.timeranges.count():
874+
ct1['timeranges_cant_meet'] = [t.slug for t in self.timeranges.all()]
875+
timeranges_str = ", ".join([t.desc for t in self.timeranges.all()])
876+
ct1['timeranges_display'] = "Can't meet %s" % timeranges_str
870877
return ct1
871878

872879

@@ -1122,6 +1129,7 @@ def json_dict(self, host_scheme):
11221129
sess1['bof'] = str(self.group.is_bof())
11231130
sess1['agenda_note'] = self.agenda_note
11241131
sess1['attendees'] = str(self.attendees)
1132+
sess1['joint_with_groups'] = self.joint_with_groups_acronyms()
11251133

11261134
# fish out scheduling information - eventually, we should pick
11271135
# this out in the caller instead

ietf/meeting/tests_api.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2013-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2013-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -12,6 +12,7 @@
1212

1313
import debug # pyflakes:ignore
1414

15+
from ietf.name.models import TimerangeName
1516
from ietf.group.models import Group
1617
from ietf.meeting.models import Schedule, TimeSlot, Session, SchedTimeSessAssignment, Meeting, Constraint
1718
from ietf.meeting.test_data import make_meeting_test_data
@@ -119,10 +120,23 @@ def test_constraints_json(self):
119120
person=Person.objects.get(user__username="ad"),
120121
name_id="bethere")
121122

123+
c_adjacent = Constraint.objects.create(meeting=meeting, source=session.group,
124+
target=Group.objects.get(acronym="irg"),
125+
name_id="wg_adjacent")
126+
127+
c_time_relation = Constraint.objects.create(meeting=meeting, source=session.group,
128+
time_relation='subsequent-days',
129+
name_id="time_relation")
130+
131+
c_timerange = Constraint.objects.create(meeting=meeting, source=session.group,
132+
name_id="timerange")
133+
c_timerange.timeranges.set(TimerangeName.objects.filter(slug__startswith='monday'))
134+
122135
r = self.client.get(urlreverse("ietf.meeting.ajax.session_constraints", kwargs=dict(num=meeting.number, sessionid=session.pk)))
123136
self.assertEqual(r.status_code, 200)
124137
constraints = r.json()
125-
self.assertEqual(set([c_ames.pk, c_person.pk]), set(c["constraint_id"] for c in constraints))
138+
expected_keys = set([c_ames.pk, c_person.pk, c_adjacent.pk, c_time_relation.pk, c_timerange.pk])
139+
self.assertEqual(expected_keys, set(c["constraint_id"] for c in constraints))
126140

127141
def test_meeting_json(self):
128142
meeting = make_meeting_test_data()

ietf/static/ietf/js/agenda/agenda_objects.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,12 +1225,30 @@ Session.prototype.generate_info_table = function() {
12251225
if(!read_only) {
12261226
$("#info_location").html(generate_select_box()+"<button id='info_location_set'>set</button>");
12271227
}
1228-
1228+
1229+
var special_requests_text = '';
1230+
if(this.joint_with_groups) {
1231+
special_requests_text += 'Joint session with ' + this.joint_with_groups.join(', ') + '. ';
1232+
}
1233+
if(this.constraints.wg_adjacent) {
1234+
for (var target_href in this.constraints.wg_adjacent) {
1235+
if (this.constraints.wg_adjacent.hasOwnProperty(target_href)) {
1236+
special_requests_text += 'Schedule adjacent with ' + this.constraints.wg_adjacent[target_href].othergroup.acronym + '. ';
1237+
}
1238+
}
1239+
}
1240+
if(this.constraints.time_relation) {
1241+
special_requests_text += this.constraints.time_relation.time_relation.time_relation_display + '. ';
1242+
}
1243+
if(this.constraints.timerange) {
1244+
special_requests_text += this.constraints.timerange.timerange.timeranges_display + '. ';
1245+
}
12291246
if("comments" in this && this.comments.length > 0 && this.comments != "None") {
1230-
$("#special_requests").text(this.comments);
1247+
special_requests_text += this.comments;
12311248
} else {
1232-
$("#special_requests").text("Special requests: None");
1249+
special_requests_text += "Special requests: None";
12331250
}
1251+
$("#special_requests").text(special_requests_text);
12341252

12351253
this.selectit();
12361254

@@ -1721,13 +1739,17 @@ Session.prototype.add_constraint_obj = function(obj) {
17211739
obj.person = person;
17221740
});
17231741
} else {
1724-
// must be conflic*
1742+
// must be conflic*, timerange, time_relation or wg_adjacent
17251743
var ogroupname;
17261744
if(obj.source_href == this.group_href) {
17271745
obj.thisgroup = this.group;
17281746
obj.othergroup = find_group_by_href(obj.target_href, "constraint src"+obj.href);
17291747
obj.direction = 'ours';
1730-
ogroupname = obj.target_href;
1748+
if (obj.target_href) {
1749+
ogroupname = obj.target_href;
1750+
} else {
1751+
ogroupname = obj.name;
1752+
}
17311753
if(this.constraints[listname][ogroupname]) {
17321754
console.log("Found multiple instances of",this.group_href,listname,ogroupname);
17331755
}

0 commit comments

Comments
 (0)