Enhance Tasklist in User Personal Dashboard
- task-code (technical, often auto-generated) + Total budgeted hours for task + Notes (usable for detailed task description) + Procentual Progression + Filtering: only active tasks (progress < 100%) + Filtering: only tasks starting from the last X months to the next Y months. X and Y are user settings for “ResourcesLoadFilterSince/From”. + Tasks sorted by date ascending - seems much more logical than descending. Check on task != null before forceLoading a task.
This commit is contained in:
parent
452e035a19
commit
8ca6f44291
2 changed files with 62 additions and 11 deletions
|
|
@ -58,22 +58,28 @@ public class MyTasksAreaController extends GenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public void render(Row row, Object data) throws Exception {
|
||||
// MvanMiddelkoop feb 2015 - changed columns: added total budgeted
|
||||
// hours for resource, added Notes, removed Code (not of any use,
|
||||
// technical code)
|
||||
|
||||
Task task = (Task) data;
|
||||
row.setValue(task);
|
||||
|
||||
Util.appendLabel(row, task.getName());
|
||||
|
||||
OrderElement orderElement = task.getOrderElement();
|
||||
Util.appendLabel(row, orderElement.getCode());
|
||||
|
||||
Util.appendLabel(row, orderElement.getOrder().getName());
|
||||
Util.appendLabel(row, task.getName());
|
||||
Util.appendLabel(row, orderElement.getDescription());
|
||||
|
||||
Util.appendLabel(row, task.getStartAsLocalDate().toString());
|
||||
Util.appendLabel(row, task.getEndAsLocalDate().toString());
|
||||
|
||||
Util.appendLabel(row, getProgress(orderElement));
|
||||
|
||||
Util.appendLabel(
|
||||
row,
|
||||
_("{0} h", task.getSumOfAssignedEffort()
|
||||
.toHoursAsDecimalWithScale(0).toString()));
|
||||
Util.appendLabel(row, _("{0} h", orderElement.getEffortAsString()));
|
||||
|
||||
Util.appendLabel(row, getProgress(orderElement));
|
||||
appendTimeTrackingButton(row, task);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.advance.entities.AdvanceMeasurement;
|
||||
import org.libreplan.business.advance.entities.DirectAdvanceAssignment;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
|
|
@ -39,6 +40,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/* mvanmiddelkoop jan 2015 - to use from and to date in tasks */
|
||||
|
||||
/**
|
||||
* Model for for "My tasks" area in the user dashboard window
|
||||
|
|
@ -66,23 +68,61 @@ public class MyTasksAreaModel implements IMyTasksAreaModel {
|
|||
return new ArrayList<Task>();
|
||||
}
|
||||
|
||||
/*
|
||||
* mvanmiddelkoop jan 2015 - Tasks from <settings> months ago to
|
||||
* <settings> month ahead
|
||||
*/
|
||||
|
||||
LocalDate myTodayDate = LocalDate.now();
|
||||
int since = 1;
|
||||
if (user.getResourcesLoadFilterPeriodSince() != null) {
|
||||
since = user.getResourcesLoadFilterPeriodSince();
|
||||
}
|
||||
int to = 3;
|
||||
if (user.getResourcesLoadFilterPeriodTo() != null) {
|
||||
to = user.getResourcesLoadFilterPeriodTo();
|
||||
}
|
||||
|
||||
List<SpecificResourceAllocation> resourceAllocations = resourceAllocationDAO
|
||||
.findSpecificAllocationsRelatedTo(scenarioManager.getCurrent(),
|
||||
UserDashboardUtil.getBoundResourceAsList(user), null,
|
||||
null);
|
||||
UserDashboardUtil.getBoundResourceAsList(user),
|
||||
myTodayDate.minusMonths(since),
|
||||
myTodayDate.plusMonths(to));
|
||||
|
||||
List<Task> tasks = new ArrayList<Task>();
|
||||
for (SpecificResourceAllocation each : resourceAllocations) {
|
||||
Task task = each.getTask();
|
||||
forceLoad(task);
|
||||
tasks.add(task);
|
||||
if (task != null) {
|
||||
forceLoad(task);
|
||||
|
||||
/* mvanmiddelkoop jan 2015 - show only unfinished tasks */
|
||||
if (task.getAdvancePercentage().intValue() < 1) {
|
||||
tasks.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sortTasksDescendingByStartDate(tasks);
|
||||
/*
|
||||
* mvanmiddelkoop jan 2015 - Sort Ascending instead of Descending
|
||||
* sortTasksDescendingByStartDate(tasks);
|
||||
*/
|
||||
sortTasksAscendingByStartDate(tasks);
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
/* mvanmiddelkoop jan 2015 - Sort Ascending instead of Descending */
|
||||
private void sortTasksAscendingByStartDate(List<Task> tasks) {
|
||||
Collections.sort(tasks, new Comparator<Task>() {
|
||||
|
||||
@Override
|
||||
public int compare(Task o1, Task o2) {
|
||||
return o1.getIntraDayStartDate().compareTo(
|
||||
o2.getIntraDayStartDate());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortTasksDescendingByStartDate(List<Task> tasks) {
|
||||
Collections.sort(tasks, new Comparator<Task>() {
|
||||
|
||||
|
|
@ -106,6 +146,11 @@ public class MyTasksAreaModel implements IMyTasksAreaModel {
|
|||
advanceMeasurement.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
// MvanMiddelkoop feb 2015 - to show the budgeted hours, prevent
|
||||
// LazyLoad errors
|
||||
task.getSumOfAssignedEffort();
|
||||
task.getOrderElement().getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue