Remove unused code

FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
Diego Pino 2012-05-19 11:26:27 +02:00
parent b5cff2cf3a
commit f698ddd890
3 changed files with 8 additions and 97 deletions

View file

@ -35,7 +35,6 @@ import org.springframework.stereotype.Component;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import br.com.digilabs.jqplot.Chart;
@ -56,7 +55,6 @@ public class DashboardController extends GenericForwardComposer {
private IDashboardModel dashboardModel;
private Grid gridTasksSummary;
private Label lblOvertimeRatio;
private Label lblAvailabilityRatio;
private Label lblAbsolute;

View file

@ -22,7 +22,6 @@ package org.libreplan.web.dashboard;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@ -55,10 +54,12 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Model for UI operations related to Order Dashboard View
*
* @author Nacho Barrientos <nacho@igalia.com>
* @author Lorenzo Tilve Álvaro <ltilve@igalia.com>
* @author Diego Pino García <dpino@igalia.com>
*
* Model for UI operations related to Order Dashboard View
*
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@ -83,10 +84,8 @@ public class DashboardModel implements IDashboardModel {
private final Map<TaskStatusEnum, BigDecimal> taskStatusStats;
private final Map<TaskDeadlineViolationStatusEnum, BigDecimal> taskDeadlineViolationStatusStats;
private List<Double> taskEstimationAccuracyHistogram;
private BigDecimal marginWithDeadLine;
private Integer absoluteMarginWithDeadLine;
private List<Double> lagInTaskCompletionHistogram;
public DashboardModel() {
taskStatusStats = new EnumMap<TaskStatusEnum, BigDecimal>(
@ -104,8 +103,6 @@ public class DashboardModel implements IDashboardModel {
this.calculateTaskViolationStatusStatistics();
this.calculateAbsoluteMarginWithDeadLine();
this.calculateMarginWithDeadLine();
this.calculateFinishedTasksEstimationAccuracyHistogram();
this.calculateLagInTaskCompletionHistogram();
}
}
@ -266,86 +263,6 @@ public class DashboardModel implements IDashboardModel {
return Days.daysBetween(start, end).getDays();
}
/* Time KPI: Estimation accuracy */
@Override
public List<Double> getFinishedTasksEstimationAccuracyHistogram() {
return this.taskEstimationAccuracyHistogram;
}
private void calculateFinishedTasksEstimationAccuracyHistogram() {
if (this.getRootTask() == null) {
throw new RuntimeException("Root task is null");
}
CalculateFinishedTasksEstimationDeviationVisitor visitor = new CalculateFinishedTasksEstimationDeviationVisitor();
TaskElement rootTask = getRootTask();
rootTask.acceptVisitor(visitor);
List<Double> deviations = visitor.getDeviations();
// [-100, -90), [-90, -80), ..., [190, 200), [200, inf)
this.taskEstimationAccuracyHistogram = createHistogram(
EA_STRETCHES_MIN_VALUE, EA_STRETCHES_MAX_VALUE,
EA_STRETCHES_PERCENTAGE_STEP, deviations);
}
/* Time KPI: Lead/Lag in task completion */
@Override
public List<Double> getLagInTaskCompletionHistogram() {
return this.lagInTaskCompletionHistogram;
}
private void calculateLagInTaskCompletionHistogram() {
if (this.getRootTask() == null) {
throw new RuntimeException("Root task is null");
}
CalculateFinishedTasksLagInCompletionVisitor visitor = new CalculateFinishedTasksLagInCompletionVisitor();
TaskElement rootTask = getRootTask();
rootTask.acceptVisitor(visitor);
List<Double> deviations = visitor.getDeviations();
if (deviations.isEmpty()) {
LTC_STRETCHES_MIN_VALUE = 0;
LTC_STRETCHES_MAX_VALUE = 0;
} else {
LTC_STRETCHES_MIN_VALUE = Collections.min(deviations);
LTC_STRETCHES_MAX_VALUE = Collections.max(deviations);
}
LTC_STRETCHES_STEP = (LTC_STRETCHES_MAX_VALUE - LTC_STRETCHES_MIN_VALUE)
/ LTC_NUMBER_OF_INTERVALS;
this.lagInTaskCompletionHistogram = createHistogram(
LTC_STRETCHES_MIN_VALUE, LTC_STRETCHES_MAX_VALUE,
LTC_STRETCHES_STEP, deviations);
}
private List<Double> createHistogram(double lowBound, double highBound,
double intervalStep, List<Double> values) {
double variableRange = highBound - lowBound;
/* TODO: What if highBound == lowBound? */
int numberOfClasses = (int) (variableRange / intervalStep);
int[] classes = new int[numberOfClasses + 1];
for (Double value : values) {
int index;
if (value >= highBound) {
index = numberOfClasses;
} else {
index = (int) (numberOfClasses * (((value.doubleValue() - lowBound)) / variableRange));
}
classes[index]++;
}
List<Double> histogram = new ArrayList<Double>();
int numberOfConsideredTasks = values.size();
for (int numberOfElementsInClass : classes) {
Double relativeCount = new Double(0.0);
if (numberOfConsideredTasks > 0) {
relativeCount = new Double(1.0 * numberOfElementsInClass
/ numberOfConsideredTasks);
}
histogram.add(relativeCount);
}
return histogram;
}
/**
* Calculates the task completation deviations for the current order
*
@ -635,4 +552,4 @@ public class DashboardModel implements IDashboardModel {
RoundingMode.HALF_UP);
}
}
}

View file

@ -20,7 +20,6 @@
package org.libreplan.web.dashboard;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.libreplan.business.orders.entities.Order;
@ -34,6 +33,8 @@ interface IDashboardModel {
boolean tasksAvailable();
/* Progress KPI: "Number of tasks by status" */
Map<TaskStatusEnum, Integer> calculateTaskStatus();
BigDecimal getPercentageOfFinishedTasks();
BigDecimal getPercentageOfInProgressTasks();
@ -68,17 +69,12 @@ interface IDashboardModel {
Integer getAbsoluteMarginWithDeadLine();
/* Time KPI: "Estimation accuracy" */
List<Double> getFinishedTasksEstimationAccuracyHistogram();
Map<Interval, Integer> calculateEstimationAccuracy();
/* Time KPI: "Lead/Lag in task completion" */
List<Double> getLagInTaskCompletionHistogram();
Map<TaskStatusEnum, Integer> calculateTaskStatus();
Map<Interval, Integer> calculateTaskCompletion();
/* Resources KPI: "Overtime Ratio" */
Map<Interval, Integer> calculateEstimationAccuracy();
// (Load + Overload) / Load
BigDecimal getOvertimeRatio();