Skip to content

Commit f57aedd

Browse files
Fix recently discovered issues for events in calendars
1 parent 20e85fa commit f57aedd

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

resources/views/scheduleAllInstruments.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,13 @@
247247
if (calendar && calendar.rerenderEvents) {
248248
calendar.rerenderEvents();
249249
} else if (calendar) {
250-
// Fallback: remove and re-add sources to force rerender
251-
const sources = Array.from(instruments.keys());
252-
sources.forEach(function(id) { removeEventSourceForInstrument(id); });
253-
sources.forEach(function(id) { addEventSourceForInstrument(id); });
250+
// Fallback: remove and re-add only currently active sources to force rerender
251+
const activeIds = [];
252+
instruments.forEach(function(info, id) {
253+
if (info && info.source) activeIds.push(id);
254+
});
255+
activeIds.forEach(function(id) { removeEventSourceForInstrument(id); });
256+
activeIds.forEach(function(id) { addEventSourceForInstrument(id); });
254257
}
255258
});
256259
}

resources/views/scheduleInstrument.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ <h3>Time Scheduled</h3>
266266
},
267267
eventMouseEnter: function (mouseEnterInfo) {
268268
removeEventLog();
269-
let instrumentID = instrument ? instrument : $('#instrumentDropDown select[name="instrumentDropDown"]').val();
269+
let instrumentID = instrument ? instrument : $('#instrumentDropDown').val();
270270
fetchInstrumentCosts(instrumentID, mouseEnterInfo.event.start, mouseEnterInfo.event.end, false);
271271
let content = '';
272272
let dateStr = DateFormat.format.date(mouseEnterInfo.event.start, LABKEY.container.formats.dateTimeFormat) + ' - ' + DateFormat.format.date(mouseEnterInfo.event.end, LABKEY.container.formats.dateTimeFormat);
@@ -688,12 +688,13 @@ <h3>Time Scheduled</h3>
688688

689689
function loadInstrumentSchedule(callback) {
690690
let instrumentSchedule = [];
691+
const currentInstrument = instrument ? instrument : parseInt($('#instrumentDropDown').val());
691692
LABKEY.Query.selectRows({
692693
schemaName: 'targetedms',
693694
queryName: 'instrumentSchedule',
694-
columns: 'Id,startTime,endTime,name,notes,instrument/color,project/Id, project/title',
695+
columns: 'Id,startTime,endTime,name,notes,instrument/color,instrument/Id,project/Id, project/title',
695696
filterArray: [
696-
LABKEY.Filter.create('instrument', instrument ? instrument : $('#instrumentDropDown select[name="instrumentDropDown"]').val()),
697+
LABKEY.Filter.create('instrument', instrument ? instrument : $('#instrumentDropDown').val()),
697698
],
698699
success: function (data) {
699700
let rows = data.rows;

0 commit comments

Comments
 (0)