parent
02fcc8a93c
commit
b843fc9d87
3 changed files with 24 additions and 24 deletions
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
|||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.planner.entities.TaskElement;
|
||||
import org.libreplan.business.planner.entities.TaskStatusEnum;
|
||||
import org.libreplan.web.dashboard.DashboardModel.IntegerInterval;
|
||||
import org.libreplan.web.dashboard.DashboardModel.Interval;
|
||||
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
|
@ -344,7 +344,7 @@ public class DashboardController extends GenericForwardComposer {
|
|||
|
||||
private final IDashboardModel dashboardModel;
|
||||
|
||||
private Map<IntegerInterval, Integer> taskCompletationData;
|
||||
private Map<Interval, Integer> taskCompletationData;
|
||||
|
||||
private TaskCompletationData(IDashboardModel dashboardModel) {
|
||||
this.dashboardModel = dashboardModel;
|
||||
|
|
@ -354,7 +354,7 @@ public class DashboardController extends GenericForwardComposer {
|
|||
return new TaskCompletationData(dashboardModel);
|
||||
}
|
||||
|
||||
private Map<IntegerInterval, Integer> getData() {
|
||||
private Map<Interval, Integer> getData() {
|
||||
if (taskCompletationData == null) {
|
||||
taskCompletationData = dashboardModel
|
||||
.calculateTaskCompletion();
|
||||
|
|
@ -363,10 +363,10 @@ public class DashboardController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public String[] getTicks() {
|
||||
Set<IntegerInterval> intervals = getData().keySet();
|
||||
Set<Interval> intervals = getData().keySet();
|
||||
String[] result = new String[intervals.size()];
|
||||
int i = 0;
|
||||
for (IntegerInterval each : intervals) {
|
||||
for (Interval each : intervals) {
|
||||
result[i++] = each.toString();
|
||||
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ public class DashboardController extends GenericForwardComposer {
|
|||
|
||||
private final IDashboardModel dashboardModel;
|
||||
|
||||
private Map<IntegerInterval, Integer> estimationAccuracyData;
|
||||
private Map<Interval, Integer> estimationAccuracyData;
|
||||
|
||||
private EstimationAccuracy(IDashboardModel dashboardModel) {
|
||||
this.dashboardModel = dashboardModel;
|
||||
|
|
@ -398,7 +398,7 @@ public class DashboardController extends GenericForwardComposer {
|
|||
return new EstimationAccuracy(dashboardModel);
|
||||
}
|
||||
|
||||
private Map<IntegerInterval, Integer> getData() {
|
||||
private Map<Interval, Integer> getData() {
|
||||
if (estimationAccuracyData == null) {
|
||||
estimationAccuracyData = dashboardModel
|
||||
.calculateEstimationAccuracy();
|
||||
|
|
@ -407,10 +407,10 @@ public class DashboardController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public String[] getTicks() {
|
||||
Set<IntegerInterval> intervals = getData().keySet();
|
||||
Set<Interval> intervals = getData().keySet();
|
||||
String[] result = new String[intervals.size()];
|
||||
int i = 0;
|
||||
for (IntegerInterval each : intervals) {
|
||||
for (Interval each : intervals) {
|
||||
result[i++] = each.toString();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ public class DashboardModel implements IDashboardModel {
|
|||
* interval
|
||||
*/
|
||||
@Override
|
||||
public Map<IntegerInterval, Integer> calculateTaskCompletion() {
|
||||
public Map<Interval, Integer> calculateTaskCompletion() {
|
||||
List<Double> deviations = getTaskLagDeviations();
|
||||
return calculateHistogramIntervals(deviations, 6, 1);
|
||||
}
|
||||
|
|
@ -313,14 +313,14 @@ public class DashboardModel implements IDashboardModel {
|
|||
* interval.
|
||||
*/
|
||||
@Override
|
||||
public Map<IntegerInterval, Integer> calculateEstimationAccuracy() {
|
||||
public Map<Interval, Integer> calculateEstimationAccuracy() {
|
||||
List<Double> deviations = getEstimationAccuracyDeviations();
|
||||
return calculateHistogramIntervals(deviations, 6, 10);
|
||||
}
|
||||
|
||||
private Map<IntegerInterval, Integer> calculateHistogramIntervals(
|
||||
private Map<Interval, Integer> calculateHistogramIntervals(
|
||||
List<Double> values, int intervalsNumber, int intervalMinimumSize) {
|
||||
Map<IntegerInterval, Integer> result = new LinkedHashMap<IntegerInterval, Integer>();
|
||||
Map<Interval, Integer> result = new LinkedHashMap<Interval, Integer>();
|
||||
|
||||
int totalMinimumSize = intervalsNumber * intervalMinimumSize;
|
||||
int halfSize = totalMinimumSize / 2;
|
||||
|
|
@ -390,15 +390,15 @@ public class DashboardModel implements IDashboardModel {
|
|||
if (deltaDecimalPart == 0 && i != (intervalsNumber - 1)) {
|
||||
to--;
|
||||
}
|
||||
result.put(new IntegerInterval(from, to), Integer.valueOf(0));
|
||||
result.put(new Interval(from, to), Integer.valueOf(0));
|
||||
|
||||
from = to + 1;
|
||||
}
|
||||
|
||||
// Construct map with number of tasks for each interval
|
||||
final Set<IntegerInterval> intervals = result.keySet();
|
||||
final Set<Interval> intervals = result.keySet();
|
||||
for (Double each : values) {
|
||||
IntegerInterval interval = IntegerInterval.containingValue(
|
||||
Interval interval = Interval.containingValue(
|
||||
intervals, each);
|
||||
if (interval != null) {
|
||||
Integer value = result.get(interval);
|
||||
|
|
@ -418,18 +418,18 @@ public class DashboardModel implements IDashboardModel {
|
|||
return visitor.getDeviations();
|
||||
}
|
||||
|
||||
static class IntegerInterval {
|
||||
static class Interval {
|
||||
private int min;
|
||||
private int max;
|
||||
|
||||
public IntegerInterval(int min, int max) {
|
||||
public Interval(int min, int max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public static IntegerInterval containingValue(
|
||||
Collection<IntegerInterval> intervals, double value) {
|
||||
for (IntegerInterval each : intervals) {
|
||||
public static Interval containingValue(
|
||||
Collection<Interval> intervals, double value) {
|
||||
for (Interval each : intervals) {
|
||||
if (each.includes(value)) {
|
||||
return each;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
|
||||
import org.libreplan.business.planner.entities.TaskElement;
|
||||
import org.libreplan.business.planner.entities.TaskStatusEnum;
|
||||
import org.libreplan.web.dashboard.DashboardModel.IntegerInterval;
|
||||
import org.libreplan.web.dashboard.DashboardModel.Interval;
|
||||
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
|
||||
|
||||
interface IDashboardModel {
|
||||
|
|
@ -73,10 +73,10 @@ interface IDashboardModel {
|
|||
Integer getAbsoluteMarginWithDeadLine();
|
||||
|
||||
/* Time KPI: "Estimation accuracy" */
|
||||
Map<IntegerInterval, Integer> calculateEstimationAccuracy();
|
||||
Map<Interval, Integer> calculateEstimationAccuracy();
|
||||
|
||||
/* Time KPI: "Lead/Lag in task completion" */
|
||||
Map<IntegerInterval, Integer> calculateTaskCompletion();
|
||||
Map<Interval, Integer> calculateTaskCompletion();
|
||||
|
||||
/* Resources KPI: "Overtime Ratio" */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue