ItEr26S07CUAsignacionGrupoRecursosAPlanificacionItEr25S07: ResourcesPerDayUnit can be converted to hours given the hours of the working day
This commit is contained in:
parent
54a8922311
commit
e89d431fdd
3 changed files with 12 additions and 2 deletions
|
|
@ -130,7 +130,7 @@ public class GenericResourceAllocation extends ResourceAllocation {
|
|||
}
|
||||
Integer workableHours = SameWorkHoursEveryDay
|
||||
.getDefaultWorkingDay().getWorkableHours(day);
|
||||
return resourcesPerDay.getAmount() * workableHours;
|
||||
return resourcesPerDay.asHoursGivenResourceWorkingDayOf(workableHours);
|
||||
}
|
||||
|
||||
private boolean isTaskFreeDay(LocalDate day) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ public class ResourcePerDayUnit {
|
|||
|
||||
public static ResourcePerDayUnit amount(int amount) {
|
||||
return new ResourcePerDayUnit(amount);
|
||||
|
||||
}
|
||||
|
||||
private ResourcePerDayUnit(int amount) {
|
||||
|
|
@ -19,4 +18,9 @@ public class ResourcePerDayUnit {
|
|||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int asHoursGivenResourceWorkingDayOf(
|
||||
Integer resourceWorkingDayHours) {
|
||||
return getAmount() * resourceWorkingDayHours;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,10 @@ public class ResourcePerDayUnitTest {
|
|||
assertThat(units.getAmount(), equalTo(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canBeConvertedToHoursGivenTheWorkingDayHours() {
|
||||
ResourcePerDayUnit units = ResourcePerDayUnit.amount(2);
|
||||
assertThat(units.asHoursGivenResourceWorkingDayOf(8), equalTo(16));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue