Bug #1495: Fix resource usage ratios
FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
parent
0512d267f7
commit
aa77ad367c
3 changed files with 28 additions and 18 deletions
|
|
@ -25,6 +25,7 @@ import java.io.BufferedReader;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -126,19 +127,21 @@ public class DashboardController extends GenericForwardComposer {
|
|||
|
||||
private void renderOvertimeRatio() {
|
||||
BigDecimal overtimeRatio = dashboardModel.getOvertimeRatio();
|
||||
lblOvertimeRatio.setValue(String.format("%.2f", overtimeRatio.doubleValue()));
|
||||
String valueMeaning = (overtimeRatio.doubleValue() > 1) ? "negative"
|
||||
: "positive";
|
||||
lblOvertimeRatio.setValue(showAsPercentage(overtimeRatio));
|
||||
String valueMeaning = (overtimeRatio.compareTo(BigDecimal.ZERO) == 0) ? "positive"
|
||||
: "negative";
|
||||
lblOvertimeRatio.setSclass("dashboard-label-remarked " + valueMeaning);
|
||||
}
|
||||
|
||||
private String showAsPercentage(BigDecimal overtimeRatio) {
|
||||
return overtimeRatio.multiply(BigDecimal.valueOf(100)).setScale(0,
|
||||
RoundingMode.HALF_UP)
|
||||
+ " %";
|
||||
}
|
||||
|
||||
private void renderAvailabilityRatio() {
|
||||
lblAvailabilityRatio.setValue(String.format("%.2f", dashboardModel
|
||||
.getAvailabilityRatio().doubleValue()));
|
||||
String valueMeaning = (dashboardModel.getAvailabilityRatio()
|
||||
.doubleValue() > 1) ? "negative" : "positive";
|
||||
lblAvailabilityRatio.setSclass("dashboard-label-remarked "
|
||||
+ valueMeaning);
|
||||
lblAvailabilityRatio.setValue(showAsPercentage(dashboardModel
|
||||
.getAvailabilityRatio()));
|
||||
}
|
||||
|
||||
private void renderCostStatus(Order order) {
|
||||
|
|
|
|||
|
|
@ -519,12 +519,11 @@ public class DashboardModel implements IDashboardModel {
|
|||
|
||||
@Override
|
||||
public BigDecimal getOvertimeRatio() {
|
||||
EffortDuration load = sumAll(resourceLoadCalculator.getAllLoad());
|
||||
EffortDuration totalLoad = sumAll(resourceLoadCalculator.getAllLoad());
|
||||
EffortDuration overload = sumAll(resourceLoadCalculator
|
||||
.getAllOverload());
|
||||
return EffortDuration.sum(load, overload)
|
||||
.dividedByAndResultAsBigDecimal(load)
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
return overload.dividedByAndResultAsBigDecimal(totalLoad).setScale(2,
|
||||
RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
private EffortDuration sumAll(
|
||||
|
|
@ -542,11 +541,15 @@ public class DashboardModel implements IDashboardModel {
|
|||
|
||||
@Override
|
||||
public BigDecimal getAvailabilityRatio() {
|
||||
EffortDuration load = sumAll(resourceLoadCalculator.getAllLoad());
|
||||
EffortDuration totalLoad = sumAll(resourceLoadCalculator.getAllLoad());
|
||||
EffortDuration overload = sumAll(resourceLoadCalculator
|
||||
.getAllOverload());
|
||||
EffortDuration load = totalLoad.minus(overload);
|
||||
|
||||
EffortDuration capacity = sumAll(resourceLoadCalculator
|
||||
.getMaxCapacityOnResources());
|
||||
return load.dividedByAndResultAsBigDecimal(capacity).setScale(2,
|
||||
RoundingMode.HALF_UP);
|
||||
return BigDecimal.ONE.setScale(2, RoundingMode.HALF_UP).subtract(
|
||||
load.dividedByAndResultAsBigDecimal(capacity));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,14 @@ interface IDashboardModel {
|
|||
|
||||
/* Resources KPI: "Overtime Ratio" */
|
||||
|
||||
// (Load + Overload) / Load
|
||||
/**
|
||||
* Formula: Overload / (Load + Overload)
|
||||
*/
|
||||
BigDecimal getOvertimeRatio();
|
||||
|
||||
// Load / Capacity
|
||||
/**
|
||||
* Formula: 1 - (Load / Capacity)
|
||||
*/
|
||||
BigDecimal getAvailabilityRatio();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue