tatumalenko / CourseBin

SOEN 341 Team Project Repo
GNU General Public License v3.0
1 stars 1 forks source link

Filter overlapping time blocks 105 #116

Closed r-saba closed 5 years ago

r-saba commented 5 years ago

Goal- Added logic to timesOverlap function in Util.js. The function takes an array of timeBlock objects. It returns true if there is a time conflict and false otherwrise.

Logic - Sort the array according to start times. Check if the next element start time is less than the current element end time. If this is the case, return true since there is an overlap. If not continue checking rest of the elements in the this manner. If an array of 1 or less objects is passed the function returns false without going into a loop since there is no time conflicts.

Function image Test Cases image image image