Skip to content

Commit

Permalink
Update check for isOccupied (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigridge authored Dec 18, 2023
1 parent 4bf8710 commit d339434
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions backend/Api/StaffingController/ReadModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,13 @@ public static StaffingReadModel MapToReadModelList(

var detailedBookings = DetailedBookings(consultant, weekSet);

var hoursPrWorkday = consultant.Department.Organization.HoursPerWorkday;
var hoursPrWeek = hoursPrWorkday * 5;


var bookingSummary = weekSet.Select(week =>
GetBookedHours(week, detailedBookings, consultant)
).ToList();

//isOccupied should not include offered or sellable time, as it's sometimes necessary to "double-book"
//checks if the consultant has 0 availible hours each week
var isOccupied = bookingSummary.All(b =>
b.BookingModel.TotalBillable + b.BookingModel.TotalPlannedAbsences + b.BookingModel.TotalVacationHours +
b.BookingModel.TotalHolidayHours >= hoursPrWeek);
b.BookingModel.TotalSellableTime == 0);

return new StaffingReadModel(
consultant,
Expand Down

0 comments on commit d339434

Please sign in to comment.