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