Skip to content

Commit 1fe9051

Browse files
fix(schedule): correct tall view height for reservations ending before hidden blocked period
In the ScheduleTall (flipped) view, reservation height is calculated as `endTd.top - startTd.top`, where `endTd` is the row whose `data-min` matches the reservation's end timestamp. This row is normally the blocked period that immediately follows the reservation. When `hide.blocked.periods = true`, blocked period rows are absent from the DOM. The fallback `findClosestEnd()` returns the last reservable slot whose start time ≤ reservation end — one row too early. For a multi-slot reservation this produces a height that stops at the *top* of the last reservable slot rather than its bottom, leaving that slot visually empty. The single-slot case was already handled by the existing `height === 0` guard. Extend the fix to multi-slot reservations by adding `endTd.outerHeight()` to height whenever `findClosestEnd` was used (`calculatedAdjustment > 0`) and height is already non-zero. Closes: #920
1 parent a959247 commit 1fe9051

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

Web/scripts/schedule.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ function Schedule(opts, resourceGroups) {
191191
'td[data-resourceid="' + res.ResourceId + '"][data-min="' + res[endAttribute] + '"]:first'
192192
);
193193
let calculatedAdjustment = 0;
194+
// true when the exact end cell is missing (e.g. hidden blocked period)
195+
// and findClosestEnd() picked the nearest earlier slot instead
196+
let isEndApproximate = false;
194197

195198
if (startTd.length === 0) {
196199
startTd = findClosestStart(table.find('td[data-resourceid="' + res.ResourceId + '"]'), res, startAttribute);
197200
}
198201
if (endTd.length === 0) {
199202
endTd = findClosestEnd(table.find('td[data-resourceid="' + res.ResourceId + '"]'), res, endAttribute);
200203
calculatedAdjustment = endTd.outerWidth();
204+
isEndApproximate = true;
201205
}
202206
if (startTd.length === 0 || endTd.length === 0) {
203207
// does not fit in this reservation table
@@ -212,6 +216,11 @@ function Schedule(opts, resourceGroups) {
212216
if (opts.scheduleStyle === ScheduleTall) {
213217
width = startTd.outerWidth() - cellAdjustment;
214218
height = endTd.position().top - startTd.position().top;
219+
if (isEndApproximate && height > 0) {
220+
// findClosestEnd was used: endTd is the last slot STARTING before resEnd,
221+
// but height must extend through to the bottom of that slot row
222+
height += endTd.outerHeight();
223+
}
215224
top = startTd.position().top;
216225
left += cellAdjustment;
217226
}
@@ -666,8 +675,8 @@ function Schedule(opts, resourceGroups) {
666675
style="${style} ${color}"
667676
data-resid="${res.ReferenceNumber}"
668677
data-resourceid="${res.ResourceId}"
669-
data-start="${startTd.data('min')}"
670-
data-end="${endTd.data('min')}"
678+
data-start="${res.StartDate}"
679+
data-end="${res.EndDate}"
671680
${draggableAttribute}>${isNew} ${isUpdated} ${res.Label}</div>`);
672681

673682
if (res.IsReservation) {
@@ -702,8 +711,8 @@ function Schedule(opts, resourceGroups) {
702711
style="${style}"
703712
data-resid="${res.ReferenceNumber}"
704713
data-resourceid="${res.ResourceId}"
705-
data-start="${startTd.data('min')}"
706-
data-end="${endTd.data('min')}">&nbsp;</div>`);
714+
data-start="${res.BufferedStartDate}"
715+
data-end="${res.BufferedEndDate}">&nbsp;</div>`);
707716
t.append(bufferDiv);
708717
}
709718
}

0 commit comments

Comments
 (0)