If no allocation done, the initial value for assigned hours is the order hours
This commit is contained in:
parent
ab0d11df05
commit
49ba6a45d4
3 changed files with 14 additions and 1 deletions
|
|
@ -40,4 +40,8 @@ public class AggregateOfResourceAllocations {
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return resourceAllocations.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import static org.easymock.classextension.EasyMock.createMock;
|
|||
import static org.easymock.classextension.EasyMock.replay;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.matchers.JUnitMatchers.hasItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -39,6 +40,12 @@ public class AggregateOfResourceAllocationsTest {
|
|||
assertThat(aggregate.getTotalHours(), equalTo(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ifNoAllocationsIsEmpty() {
|
||||
givenAggregateOfResourceAllocationsWithAssignedHours();
|
||||
assertTrue(aggregate.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calculatesTheTotalHours() {
|
||||
givenAggregateOfResourceAllocationsWithAssignedHours(4, 5, 6);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ class FormBinder {
|
|||
}
|
||||
|
||||
private void loadValueForAssignedHoursComponent() {
|
||||
this.assignedHoursComponent.setValue(aggregate.getTotalHours());
|
||||
this.assignedHoursComponent
|
||||
.setValue(aggregate.isEmpty() ? resourceAllocationsBeingEdited
|
||||
.getTask().getWorkHours() : aggregate.getTotalHours());
|
||||
}
|
||||
|
||||
private void assignedHoursComponentDisabilityRule() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue