a new version of saving schedules as templates that supports simultaneus events
This commit is contained in:
parent
3a7314ed61
commit
2bcb9d03ba
src/main/java/se/su/dsv/scipro
@ -154,17 +154,7 @@ public abstract class Event extends LazyDeletableDomainObject
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Event other) {
|
public int compareTo(Event other) {
|
||||||
int dcomp = dueDate.compareTo(other.dueDate);
|
return (int) (dueDate.getTime() - other.dueDate.getTime());
|
||||||
if(dcomp == 0){
|
|
||||||
/*if(id == null){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (other.id == null){
|
|
||||||
return 1;
|
|
||||||
}*/
|
|
||||||
return id.compareTo(other.id);
|
|
||||||
}else
|
|
||||||
return dcomp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Panel getDisplayPanel(String id){
|
public Panel getDisplayPanel(String id){
|
||||||
|
@ -82,15 +82,13 @@ public class ScheduleGenerator {
|
|||||||
|
|
||||||
int totalDuration = 0;
|
int totalDuration = 0;
|
||||||
for(ProjectEventTemplate e : eventTemplates){
|
for(ProjectEventTemplate e : eventTemplates){
|
||||||
tempPointer = datePointer;
|
tempPointer = new DateMidnight(datePointer);
|
||||||
ProjectEvent event = e.createEventFromTemplate();
|
ProjectEvent event = e.createEventFromTemplate();
|
||||||
event.setParticipants(project.getProjectParticipants());
|
event.setParticipants(project.getProjectParticipants());//might have to remove this
|
||||||
if(e.getEstimatedTimeConsumption() < 1){
|
if(e.getEstimatedTimeConsumption() <= 1){
|
||||||
datePointer = new DateMidnight(startDate).plusDays(e.getDaysOffset());
|
datePointer = new DateMidnight(startDate).plusDays(e.getDaysOffset());
|
||||||
}
|
}
|
||||||
double duration = (double) e.getEstimatedTimeConsumption() * ratio;
|
double duration = (double) e.getEstimatedTimeConsumption() * ratio;
|
||||||
if(duration < 1.0)
|
|
||||||
duration = 1.0;
|
|
||||||
|
|
||||||
datePointer = datePointer.plusDays((int) duration);
|
datePointer = datePointer.plusDays((int) duration);
|
||||||
totalDuration += (int)duration;
|
totalDuration += (int)duration;
|
||||||
@ -104,14 +102,10 @@ public class ScheduleGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.setDueDate(datePointer.toDate());
|
event.setDueDate(datePointer.toDate());
|
||||||
event.setCreator(SciProSession.get().getUser());
|
|
||||||
event.setProjectSchedule(projectSchedule);
|
|
||||||
event = projectEventDao.save(event);
|
|
||||||
events.add(event);
|
events.add(event);
|
||||||
|
if(e.getEstimatedTimeConsumption() <= 1){
|
||||||
|
datePointer = tempPointer;
|
||||||
datePointer = tempPointer;
|
}
|
||||||
System.out.println(event);
|
|
||||||
}
|
}
|
||||||
return new ScheduleGeneratorResult(template, events, totalDuration, templateEstimatedDays, startDate.toDate(), endDate.toDate());
|
return new ScheduleGeneratorResult(template, events, totalDuration, templateEstimatedDays, startDate.toDate(), endDate.toDate());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user