ItEr40S05ValidacionEProbasFuncionaisItEr39S05: [Bug #195] Fixing bug. getDaysDuration is calculate dnow based on the date part
This commit is contained in:
parent
52fd1bbf27
commit
00d85c3d10
2 changed files with 11 additions and 2 deletions
|
|
@ -165,8 +165,9 @@ public class Task extends TaskElement {
|
|||
}
|
||||
|
||||
public Integer getDaysDuration() {
|
||||
Days daysBetween = Days.daysBetween(toDateTime(getStartDate()),
|
||||
toDateTime(getEndDate()));
|
||||
Days daysBetween = Days.daysBetween(new LocalDate(
|
||||
toDateTime(getStartDate())), new LocalDate(
|
||||
toDateTime(getEndDate())));
|
||||
return daysBetween.getDays();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Test;
|
||||
import org.navalplanner.business.orders.entities.HoursGroup;
|
||||
import org.navalplanner.business.orders.entities.OrderLine;
|
||||
|
|
@ -126,6 +127,13 @@ public class TaskTest {
|
|||
assertThat(task.getAssignedHours(), equalTo(8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theDaysBetweenIsCalculatedBasedOnlyOnDatesNotHours() {
|
||||
task.setStartDate(new DateTime(2008, 10, 5, 23, 0, 0, 0).toDate());
|
||||
task.setEndDate(new DateTime(2008, 10, 6, 1, 0, 0, 0).toDate());
|
||||
assertThat(task.getDaysDuration(), equalTo(1));
|
||||
}
|
||||
|
||||
private SpecificResourceAllocation stubResourceAllocationWithAssignedHours(
|
||||
Task task,
|
||||
int hours) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue