Berücksichtige zweiwöchentliche Rythmen bei der Raumkapazität

This commit is contained in:
Gonne 2022-10-20 08:46:39 +02:00
parent ae3f261047
commit 12a5080659

View file

@ -240,7 +240,9 @@ func (r *OfficeHourRepo) NumberByTimeSpanAndRoom(date models.Date, duration int,
for _, officeHour := range officeHours { for _, officeHour := range officeHours {
// increase count if officehour starts before this point in time and ends later // increase count if officehour starts before this point in time and ends later
if models.DateLess(officeHour.Date, models.GetEndDate(date, minute, false)) && models.DateLess(models.GetEndDate(date, minute, false), models.GetEndDate(officeHour.Date, officeHour.Duration, false)) { if models.DateLess(officeHour.Date, models.GetEndDate(date, minute, false)) && models.DateLess(models.GetEndDate(date, minute, false), models.GetEndDate(officeHour.Date, officeHour.Duration, false)) {
minuteCount += 1 if date.Week == 0 || officeHour.Week == 0 || date.Week == officeHour.Week { // office hours in alternating weeks should not collide
minuteCount += 1
}
} }
} }
if minuteCount > count { if minuteCount > count {