Skip to content

Commit 53feb01

Browse files
committed
Have group conflicts showing now - not sure find-free is working yet
- Legacy-Id: 7551
1 parent e953538 commit 53feb01

3 files changed

Lines changed: 111 additions & 46 deletions

File tree

static/css/agenda.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ div#conflict_table {
502502
background-color: #89D;
503503
}
504504

505+
div.conflictlevel {
506+
display: inline-block;
507+
min-width: 1.5em;
508+
}
509+
505510
div.our-conflict {
506511
padding-left: 20px;
507512
background-image: url('/images/conflict-boxes/narow3.png');

static/js/agenda/agenda_listeners.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,15 +881,42 @@ function group_name_or_empty(constraint) {
881881
function draw_constraints(session) {
882882

883883
if("conflicts" in session) {
884+
var display = { 'conflict':'1' , 'conflic2':'2' , 'conflic3':'3' };
884885
var group_icons = "";
885-
886+
var group_set = {};
886887
$.each(session.conflicts, function(index) {
887888
conflict = session.conflicts[index];
889+
conflict.build_othername();
888890
if(conflict.conflict_groupP()) {
889-
group_icons += "<li class='conflict'>"+conflict.conflict_view();
891+
if ( ! (conflict.othergroup_name in group_set) ) {
892+
group_set[conflict.othergroup_name] = {};
893+
}
894+
group_set[conflict.othergroup_name][conflict.direction]=display[conflict.conflict_type];
895+
// This had been in build_group_conflict_view
896+
conflict.populate_conflict_classes();
890897
highlight_conflict(conflict);
891898
}
892899
});
900+
901+
902+
$.each(group_set, function(index) {
903+
group = group_set[index];
904+
group_view = "<li class='conflict'>";
905+
group_view += "<div class='conflictlevel'>"
906+
if ('ours' in group_set[index]) {
907+
group_view += group_set[index].ours+"->"
908+
}
909+
group_view += "</div>"
910+
group_view += index;
911+
group_view += "<div class='conflictlevel'>"
912+
if ('theirs' in group_set[index]) {
913+
group_view += "->"+group_set[index].theirs
914+
}
915+
group_view += "</div>"
916+
group_view += "</li>";
917+
group_icons += group_view;
918+
});
919+
893920
if(group_icons == "") {
894921
$("#conflict_group_list").html("none");
895922
} else {

static/js/agenda/agenda_objects.js

Lines changed: 77 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ function Session() {
680680
this.area = "noarea";
681681
this.special_request = "";
682682
this.conflicted = false;
683+
this.conflicted_direction = {};
683684
this.theirconflicted = false;
684685
this.double_wide = false;
685686
this.attendees = undefined;
@@ -886,36 +887,31 @@ Session.prototype.mark_conflict = function(value) {
886887
this.conflicted = value;
887888
};
888889
Session.prototype.add_conflict = function(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;
890+
this.conflicted = true;
891+
if (this.conflicted_direction==undefined) {
892+
this.conflicted_direction={};
893+
}
894+
this.conflicted_direction[conflict.direction] = true;
895+
if (this.highest_conflict==undefined) {
896+
this.highest_conflict={};
897+
}
898+
if(this.highest_conflict[conflict.direction]==undefined) {
899+
this.highest_conflict[conflict.direction] = conflict;
903900
} else {
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-
}
901+
var oldhighest = this.highest_conflict[conflict.direction];
902+
this.highest_conflict[conflict.direction] = this.highest_conflict[conflict.direction].conflict_compare(conflict);
903+
if(_conflict_debug) {
904+
console.log("add conflict for", this.title,
905+
oldhighest.conflict_type, ">?", conflict.conflict_type,
906+
"=", this.highest_conflict[conflict.direction].conflict_type);
915907
}
916-
this.theirconflict_level = this.highest_theirconflict.conflict_type;
917908
}
909+
if (this.conflict_level==undefined){
910+
this.conflict_level={};
911+
}
912+
this.conflict_level[conflict.direction] = this.highest_conflict[conflict.direction].conflict_type;
918913
};
914+
919915
Session.prototype.clear_conflict = function() {
920916
this.conflicted = false;
921917
};
@@ -936,45 +932,48 @@ Session.prototype.clear_all_conflicts = function(old_column_classes) {
936932

937933
Session.prototype.show_conflict = function() {
938934
if(_conflict_debug) {
939-
console.log("showing conflict for", this.title, this.conflict_level);
935+
console.log("showing conflict for", this.title, this.conflict_level['ours'],this.conflict_level['theirs']);
940936
}
941-
// this.element().find('.ourconflicts').addClass("actual_" + this.conflict_level);
942-
// this.element().find('.theirconflicts').addClass("actual_" + this.conflict_level);
943937
var display = { 'conflict':'1' , 'conflic2':'2' , 'conflic3':'3' };
944938
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]+'->');
939+
if ('ours' in this.conflict_level) {
940+
this.element().find('.ourconflicts').text('->'+display[this.conflict_level.ours]);
941+
}
942+
if ('theirs' in this.conflict_level) {
943+
this.element().find('.theirconflicts').text(display[this.conflict_level.theirs]+'->');
944+
}
949945
}
950946
};
947+
951948
Session.prototype.hide_conflict = function() {
952949
if(_conflict_debug) {
953950
console.log("removing conflict for", this.title);
954951
}
955-
// this.element().removeClass("actual_conflict");
956952
this.element().find('.ourconflicts').text('');
957953
this.element().find('.theirconflicts').text('');
958954
};
955+
959956
Session.prototype.display_conflict = function() {
960957
if(this.conflicted || this.theirconflicted) {
961958
this.show_conflict();
962959
} else {
963960
this.hide_conflict();
964961
}
965962
};
963+
966964
Session.prototype.reset_conflicts = function() {
967965
this.conflict_level = undefined;
968966
this.highest_conflict = undefined;
969967
this.conflicted = false;
968+
this.conflicted_direction = undefined;
970969
this.theirconflict_level = undefined;
971970
this.highest_theirconflict = undefined;
972971
this.theirconflicted = false;
973972
};
974973

975974
Session.prototype.show_personconflict = function() {
976975
if(_conflict_debug) {
977-
console.log("showing person conflict for", this.title, this.conflict_level);
976+
console.log("showing person conflict for", this.title, this.conflict_level.ours);
978977
}
979978
this.personconflict_element().removeClass("hidepersonconflict");
980979
this.personconflict_element().addClass("showpersonconflict");
@@ -1294,6 +1293,21 @@ Session.prototype.fill_in_constraints = function(constraint_list) {
12941293
session_obj.conflicts.push(session_obj.constraints["conflic3"][index]);
12951294
});
12961295
}
1296+
if("conflict" in this.theirconstraints) {
1297+
$.each(this.theirconstraints["conflict"], function(index) {
1298+
session_obj.conflicts.push(session_obj.theirconstraints["conflict"][index]);
1299+
});
1300+
}
1301+
if("conflic2" in this.theirconstraints) {
1302+
$.each(this.theirconstraints["conflic2"], function(index) {
1303+
session_obj.conflicts.push(session_obj.theirconstraints["conflic2"][index]);
1304+
});
1305+
}
1306+
if("conflic3" in this.theirconstraints) {
1307+
$.each(this.theirconstraints["conflic3"], function(index) {
1308+
session_obj.conflicts.push(session_obj.theirconstraints["conflic3"][index]);
1309+
});
1310+
}
12971311
this.calculate_bethere();
12981312
this.conflicts = sort_conflict_list(this.conflicts)
12991313
};
@@ -1573,17 +1587,35 @@ Constraint.prototype.show_conflict_view = function() {
15731587
//console.log("viewed", this.thisgroup.href);
15741588
};
15751589

1576-
Constraint.prototype.build_group_conflict_view = function() {
1577-
1590+
Constraint.prototype.populate_conflict_classes = function() {
15781591
// this is used for the red square highlighting.
15791592
var checkbox_id = "conflict_"+this.dom_id;
15801593
conflict_classes[checkbox_id] = this;
1581-
1582-
return "<div class='conflict our-"+this.conflict_type+"' id='"+this.dom_id+
1583-
"'>"+this.othergroup_name+"</div>";
1584-
15851594
};
15861595

1596+
// Made dead by change to how the group view is built out
1597+
//Constraint.prototype.build_group_conflict_view = function() {
1598+
//
1599+
// var display = { 'conflict':'1' , 'conflic2':'2' , 'conflic3':'3' };
1600+
//
1601+
// // this is used for the red square highlighting.
1602+
// var checkbox_id = "conflict_"+this.dom_id;
1603+
// conflict_classes[checkbox_id] = this;
1604+
//
1605+
// build = "<div id='"+this.dom_id+"'>";
1606+
// if (this.direction=='theirs') {
1607+
// build += display[this.conflict_type]+"->";
1608+
// }
1609+
// build += this.othergroup_name;
1610+
// if (this.direction=='ours') {
1611+
// build += "->"+display[this.conflict_type];
1612+
// }
1613+
// build += "</div>";
1614+
//
1615+
// return build
1616+
//
1617+
//};
1618+
15871619
Constraint.prototype.build_people_conflict_view = function() {
15881620
var area_mark = "";
15891621
if(this.person != undefined && this.person.area_mark_basic != undefined) {
@@ -1612,9 +1644,10 @@ Constraint.prototype.conflict_view = function() {
16121644
return this.build_people_conflict_view();
16131645
}
16141646
else {
1615-
//console.log("conflict_view for", this.href);
1616-
this.build_othername();
1617-
return this.build_group_conflict_view();
1647+
// This function is currently never called for this case
1648+
console.log("!! unexpected conflict_view for", this.href);
1649+
//this.build_othername();
1650+
//return this.build_group_conflict_view();
16181651
}
16191652
};
16201653

0 commit comments

Comments
 (0)