[Bug #1162] Fix issues in stretches function dedication chart

Chart was wrong calculated, as for each stretch it takes into account
the day after to calculate the non workable days, so if a stretch ends
in Friday it showed wrong values.

FEA: ItEr75S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2011-10-31 17:37:26 +01:00
parent ad3e033ed8
commit e3fe3f1a27

View file

@ -129,12 +129,13 @@ public abstract class GraphicForStreches implements IGraphicGenerator {
for (Stretch stretch : stretches) {
BigDecimal amountWork = stretch.getAmountWorkPercentage()
.subtract(previousPercentage).multiply(taskHours);
Integer days = Days.daysBetween(previousDate,
stretch.getDateIn(allocation)).getDays();
LocalDate endDate = stretch.getDateIn(allocation);
Integer days = Days.daysBetween(previousDate, endDate)
.getDays();
if (calendar != null) {
days -= calendar.getNonWorkableDays(previousDate,
stretch.getDateIn(allocation)).size();
endDate.minusDays(1)).size();
}
BigDecimal hoursPerDay = BigDecimal.ZERO;
@ -144,11 +145,13 @@ public abstract class GraphicForStreches implements IGraphicGenerator {
}
xymodel.addValue(title, previousDate.toDateTimeAtStartOfDay()
.getMillis() + 1, hoursPerDay);
xymodel.addValue(title, stretch.getDateIn(allocation)
.toDateTimeAtStartOfDay().getMillis(), hoursPerDay);
.getMillis(), hoursPerDay);
if (days > 0) {
xymodel.addValue(title, endDate.toDateTimeAtStartOfDay()
.getMillis() - 1, hoursPerDay);
}
previousDate = stretch.getDateIn(allocation);
previousDate = endDate;
previousPercentage = stretch.getAmountWorkPercentage();
}