Skip to content

Commit e953538

Browse files
committed
checkpoint before refactoring the conflict array
- Legacy-Id: 7548
1 parent e3d9469 commit e953538

2 files changed

Lines changed: 81 additions & 25 deletions

File tree

static/css/agenda.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,11 +847,13 @@ table.actual_conflic3 {
847847
border: solid 1px #203E5F;
848848
}
849849

850+
/*
850851
.agenda_row_alt td {
851852
/* for now, use no alternating theme */
852853
border-bottom: 1px solid orange;
853854
margin-bottom: 5px;
854855
}
856+
*/
855857

856858
.agenda_slot_plenary {
857859
/* background-color: #d38f2d; */ /* dark orange */

static/js/agenda/agenda_objects.js

Lines changed: 79 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,25 @@ function find_and_populate_conflicts(session_obj) {
183183
});
184184
}
185185

186+
if(session_obj.theirconstraints.conflict != null){
187+
$.each(session_obj.theirconstraints.conflict, function(i){
188+
var conflict = session_obj.theirconstraints.conflict[i];
189+
calculate_real_conflict(conflict, vertical_location, room_tag, session_obj);
190+
});
191+
}
192+
if(session_obj.theirconstraints.conflic2 != null){
193+
$.each(session_obj.theirconstraints.conflic2, function(i){
194+
var conflict = session_obj.theirconstraints.conflic2[i];
195+
calculate_real_conflict(conflict, vertical_location, room_tag, session_obj);
196+
});
197+
}
198+
if(session_obj.theirconstraints.conflic3 != null){
199+
$.each(session_obj.theirconstraints.conflic3, function(i){
200+
var conflict = session_obj.theirconstraints.conflic3[i];
201+
calculate_real_conflict(conflict, vertical_location, room_tag, session_obj);
202+
});
203+
}
204+
186205
/* bethere constraints are processed in another loop */
187206
}
188207
}
@@ -649,6 +668,7 @@ function make_ss(json) {
649668

650669
function Session() {
651670
this.constraints = {};
671+
this.theirconstraints = {};
652672
this.constraint_load_andthen_list = [];
653673
this.constraints_loaded = false;
654674
this.last_timeslot_id = null;
@@ -660,6 +680,7 @@ function Session() {
660680
this.area = "noarea";
661681
this.special_request = "";
662682
this.conflicted = false;
683+
this.theirconflicted = false;
663684
this.double_wide = false;
664685
this.attendees = undefined;
665686
}
@@ -865,19 +886,35 @@ Session.prototype.mark_conflict = function(value) {
865886
this.conflicted = value;
866887
};
867888
Session.prototype.add_conflict = function(conflict) {
868-
this.conflicted = true;
869-
if(this.highest_conflict==undefined) {
870-
this.highest_conflict = conflict;
889+
if (conflict.direction==='ours') {
890+
this.conflicted = true;
891+
if(this.highest_conflict==undefined) {
892+
this.highest_conflict = conflict;
893+
} else {
894+
var oldhighest = this.highest_conflict;
895+
this.highest_conflict = this.highest_conflict.conflict_compare(conflict);
896+
if(_conflict_debug) {
897+
console.log("add conflict for", this.title,
898+
oldhighest.conflict_type, ">?", conflict.conflict_type,
899+
"=", this.highest_conflict.conflict_type);
900+
}
901+
}
902+
this.conflict_level = this.highest_conflict.conflict_type;
871903
} else {
872-
var oldhighest = this.highest_conflict;
873-
this.highest_conflict = this.highest_conflict.conflict_compare(conflict);
874-
if(_conflict_debug) {
875-
console.log("add conflict for", this.title,
876-
oldhighest.conflict_type, ">?", conflict.conflict_type,
877-
"=", this.highest_conflict.conflict_type);
904+
this.theirconflicted = true;
905+
if(this.highest_theirconflict==undefined) {
906+
this.highest_theirconflict = conflict;
907+
} else {
908+
var oldhighest = this.highest_theirconflict;
909+
this.highest_theirconflict = this.highest_theirconflict.conflict_compare(conflict);
910+
if(_conflict_debug) {
911+
console.log("add conflict for", this.title,
912+
oldhighest.conflict_type, ">?", conflict.conflict_type,
913+
"=", this.highest_theirconflict.conflict_type);
914+
}
878915
}
916+
this.theirconflict_level = this.highest_theirconflict.conflict_type;
879917
}
880-
this.conflict_level = this.highest_conflict.conflict_type;
881918
};
882919
Session.prototype.clear_conflict = function() {
883920
this.conflicted = false;
@@ -901,16 +938,26 @@ Session.prototype.show_conflict = function() {
901938
if(_conflict_debug) {
902939
console.log("showing conflict for", this.title, this.conflict_level);
903940
}
904-
this.element().addClass("actual_" + this.conflict_level);
941+
// this.element().find('.ourconflicts').addClass("actual_" + this.conflict_level);
942+
// this.element().find('.theirconflicts').addClass("actual_" + this.conflict_level);
943+
var display = { 'conflict':'1' , 'conflic2':'2' , 'conflic3':'3' };
944+
if (this.conflicted) {
945+
this.element().find('.ourconflicts').text('->'+display[this.conflict_level]);
946+
}
947+
if (this.theirconflicted) {
948+
this.element().find('.theirconflicts').text(display[this.theirconflict_level]+'->');
949+
}
905950
};
906951
Session.prototype.hide_conflict = function() {
907952
if(_conflict_debug) {
908953
console.log("removing conflict for", this.title);
909954
}
910-
this.element().removeClass("actual_conflict");
955+
// this.element().removeClass("actual_conflict");
956+
this.element().find('.ourconflicts').text('');
957+
this.element().find('.theirconflicts').text('');
911958
};
912959
Session.prototype.display_conflict = function() {
913-
if(this.conflicted) {
960+
if(this.conflicted || this.theirconflicted) {
914961
this.show_conflict();
915962
} else {
916963
this.hide_conflict();
@@ -920,6 +967,9 @@ Session.prototype.reset_conflicts = function() {
920967
this.conflict_level = undefined;
921968
this.highest_conflict = undefined;
922969
this.conflicted = false;
970+
this.theirconflict_level = undefined;
971+
this.highest_theirconflict = undefined;
972+
this.theirconflicted = false;
923973
};
924974

925975
Session.prototype.show_personconflict = function() {
@@ -1106,12 +1156,12 @@ Session.prototype.event_template = function() {
11061156
"' id='session_"+
11071157
this.session_id+
11081158
"' session_id=\""+this.session_id+"\"" +
1109-
"><tr id='meeting_event_title'><th class='"+
1159+
"><tr id='meeting_event_title'><td class=\"theirconflicts\"></td><th class='"+
11101160
this.wg_scheme()+" "+
11111161
this.area_scheme() +" meeting_obj'>"+
11121162
this.visible_title()+
11131163
"<span> ("+this.requested_duration+")</span>" +
1114-
"</th>"+pinned+"</tr></table>"+ area_mark +"</div></div>";
1164+
"</th><td class=\"ourconflicts\"></td>"+pinned+"</tr></table>"+ area_mark +"</div></div>";
11151165
};
11161166

11171167
function andthen_alert(object, result, arg) {
@@ -1524,17 +1574,13 @@ Constraint.prototype.show_conflict_view = function() {
15241574
};
15251575

15261576
Constraint.prototype.build_group_conflict_view = function() {
1527-
var bothways = "&nbsp;&nbsp;&nbsp;";
1528-
if(this.bothways) {
1529-
bothways=" &lt;-&gt;";
1530-
}
15311577

15321578
// this is used for the red square highlighting.
15331579
var checkbox_id = "conflict_"+this.dom_id;
15341580
conflict_classes[checkbox_id] = this;
15351581

15361582
return "<div class='conflict our-"+this.conflict_type+"' id='"+this.dom_id+
1537-
"'>"+this.othergroup_name+bothways+"</div>";
1583+
"'>"+this.othergroup_name+"</div>";
15381584

15391585
};
15401586

@@ -1593,6 +1639,9 @@ Session.prototype.add_constraint_obj = function(obj) {
15931639
if(this.constraints[listname]==undefined) {
15941640
this.constraints[listname]={};
15951641
}
1642+
if(this.theirconstraints[listname]==undefined) {
1643+
this.theirconstraints[listname]={};
1644+
}
15961645

15971646
if(listname == "bethere") {
15981647
//console.log("bethere constraint: ", obj);
@@ -1611,18 +1660,23 @@ Session.prototype.add_constraint_obj = function(obj) {
16111660
if(obj.source_href == this.group_href) {
16121661
obj.thisgroup = this.group;
16131662
obj.othergroup = find_group_by_href(obj.target_href, "constraint src"+obj.href);
1663+
obj.direction = 'ours';
16141664
ogroupname = obj.target_href;
1665+
if(this.constraints[listname][ogroupname]) {
1666+
console.log("Found multiple instances of",this.group_href,listname,ogroupname);
1667+
}
1668+
this.constraints[listname][ogroupname] = obj
16151669
} else {
16161670
obj.thisgroup = this.group;
16171671
obj.othergroup = find_group_by_href(obj.source_href, "constraint dst"+obj.href);
1672+
obj.direction = 'theirs';
16181673
ogroupname = obj.source_href;
1674+
if(this.theirconstraints[listname][ogroupname]) {
1675+
console.log("Found multiple instances of",ogroupname,listname,this.group_href);
1676+
}
1677+
this.theirconstraints[listname][ogroupname] = obj
16191678
}
16201679

1621-
if(this.constraints[listname][ogroupname]) {
1622-
this.constraints[listname][ogroupname].bothways = true;
1623-
} else {
1624-
this.constraints[listname][ogroupname]=obj;
1625-
}
16261680
}
16271681

16281682
};

0 commit comments

Comments
 (0)