helpers/schedule.js
// Returns a list of time slots with start, end, and availability
Returns a list of time slots with start, end, and availability
Returns a list of time slots with start end and availability
function checkAvailability(schedule, meetingList) {
  if (schedule.length === 0) {
    return [];
  }
  var overlap = meetingList.filter(
    (meeting) =>
      (meeting.start >= schedule[0].start &&
        meeting.start < schedule[schedule.length - 1].end) ||
      (meeting.end > schedule[0].start &&
        meeting.end <= schedule[schedule.length - 1].end)
  );
  schedule.forEach((sched) => {
    overlap.forEach((meeting) => {
      if (
        (sched.start >= meeting.start && sched.start < meeting.end) ||
        (sched.end > meeting.start && sched.end <= meeting.end)
      ) {
        sched.available = false;
      }
    });
  });
  return schedule;
}
function checkAvailability ( schedule , meetingList ) { if ( schedule . length === 0 ) { return [ ] ; } var overlap = meetingList . filter ( ( meeting ) => ( meeting . start >= schedule [ 0 ] . start && meeting . start < schedule [ schedule . length - 1 ] . end ) || ( meeting . end > schedule [ 0 ] . start && meeting . end <= schedule [ schedule . length - 1 ] . end ) ) ; schedule . forEach ( ( sched ) => { overlap . forEach ( ( meeting ) => { if ( ( sched . start >= meeting . start && sched . start < meeting . end ) || ( sched . end > meeting . start && sched . end <= meeting . end ) ) { sched . available = false ; } } ) ; } ) ; return schedule ; }
Returns a list of time slots with start, end, and availability
Returns a list of time slots with start end and availability
// Separate scheduled meetings that fall between the start of the first time slot, and end of last time slot // If the meeting overlaps with a schedule slot, set the slot availability to false