// Generate last day assignment
PartialDay firstDay = new PartialDay(IntraDayDate.startOfDay(date),
IntraDayDate.create(date, hours(endTime.getHour())));
EffortDuration effortCanAllocate = min(totalIntended,
calendar.asDurationOn(firstDay, ONE_RESOURCE_PER_DAY));
if (effortCanAllocate.compareTo(zero()) > 0) {
DayAssignment dayAssignment = createDayAssignment(
resourceAllocation, resource, date, effortCanAllocate);
totalIntended = totalIntended.minus(addDayAssignment(result,
dayAssignment));
}