fix: Show overfull style based on max, not sum, of session durations (#5044)
* fix: Show overfull style based on max, not sum, of session durations * style: Avoid shadowing 'sessions' from outer scope
This commit is contained in:
parent
23f38e2ebc
commit
408c1ea9a4
|
@ -647,12 +647,9 @@ $(function () {
|
|||
|
||||
function updateTimeSlotDurationViolations() {
|
||||
timeslots.each(function () {
|
||||
let total = 0;
|
||||
jQuery(this).find(".session").each(function () {
|
||||
total += +jQuery(this).data("duration");
|
||||
});
|
||||
|
||||
jQuery(this).toggleClass("overfull", total > +jQuery(this).data("duration"));
|
||||
const sessionsInSlot = Array.from(this.getElementsByClassName('session'));
|
||||
const requiredDuration = Math.max(sessionsInSlot.map(elt => Number(elt.dataset.duration)));
|
||||
this.classList.toggle('overfull', requiredDuration > Number(this.dataset.duration));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue