Skip to content

Commit

Permalink
fix: Show overfull style based on max, not sum, of session durations (#…
Browse files Browse the repository at this point in the history
…5044)

* fix: Show overfull style based on max, not sum, of session durations

* style: Avoid shadowing 'sessions' from outer scope
  • Loading branch information
jennifer-richards committed Jan 27, 2023
1 parent 23f38e2 commit 408c1ea
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ietf/static/js/edit-meeting-schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}

Expand Down

0 comments on commit 408c1ea

Please sign in to comment.