Commit 42850e78 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX #29 for ours-* conflict resolution modes

parent 8253b6f9
......@@ -356,6 +356,8 @@ export default {
resolveEvent (toResolve, mode) {
let calendarSlot = this.calendarSlots.find(s => s.id === toResolve.id)
let originalSlot = this.resolveData.projected.find(s => s.hash === toResolve.hash)
// we only need the conflicting slot specifically for theirs-both mode, where there should be only one collision
let conflictingSlot = this.calendarSlots.find(s => s.id === toResolve.collisions[0].id)
// we only reduce the conflict count, if there was no other solution set already
if (this.conflictSolutions[toResolve.hash] === '') {
......@@ -370,6 +372,11 @@ export default {
this.calendarSlots.splice(oldResolutionSlot, 1)
}
// and in case their was a ours-* choice before, we have to reset the (one)
// conflicting slot to its original start and end time
conflictingSlot.start = toResolve.collisions[0].start
conflictingSlot.end = toResolve.collisions[0].end
// for a detailed description of the resolution modes, see conflict-resolution.md
// and conflict-resolution.pdf at https://gitlab.servus.at/autoradio/meta
switch (mode) {
......@@ -379,7 +386,7 @@ export default {
calendarSlot.title = 'new'
calendarSlot.start = originalSlot.start
calendarSlot.end = originalSlot.end
for (let theirs of toResolve.collisions) {
for (let theirs of toResolve.collisions) {
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-accepted'
}
this.renderView(null)
......@@ -431,10 +438,28 @@ export default {
case 'ours-end':
case 'ours-both':
this.conflictSolutions[toResolve.hash] = mode
calendarSlot.className = 'timeslot-partly'
calendarSlot.className = 'timeslot-accepted'
calendarSlot.title = 'new [' + mode + ']'
if (mode === 'ours-start') {
conflictingSlot.start = toResolve.collisions[0].start
conflictingSlot.end = originalSlot.start
} else if (mode === 'ours-end') {
conflictingSlot.start = originalSlot.end
conflictingSlot.end = toResolve.collisions[0].end
} else {
conflictingSlot.start = toResolve.collisions[0].start
conflictingSlot.end = originalSlot.start
this.calendarSlots.push({
id: calendarSlot.id * 10,
start: originalSlot.end,
end: toResolve.collisions[0].end,
title: conflictingSlot.title,
className: 'timeslot-partly',
editable: false,
})
}
for (let theirs of toResolve.collisions) {
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-partly-theirs'
this.calendarSlots.find(s => s.id === theirs.id).className = 'timeslot-partly'
}
this.renderView(null)
break
......@@ -579,8 +604,4 @@ a.currentShow {
opacity: 0.5;
font-weight: bold;
}
.timeslot-partly-theirs {
background-color: #17a2b8;
opacity: 0.25;
}
</style>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment