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
|
||||
public int compareTo(Event other) {
|
||||
int dcomp = dueDate.compareTo(other.dueDate);
|
||||
if(dcomp == 0){
|
||||
/*if(id == null){
|
||||
return -1;
|
||||
}
|
||||
else if (other.id == null){
|
||||
return 1;
|
||||
}*/
|
||||
return id.compareTo(other.id);
|
||||
}else
|
||||
return dcomp;
|
||||
return (int) (dueDate.getTime() - other.dueDate.getTime());
|
||||
}
|
||||
|
||||
public Panel getDisplayPanel(String id){
|
||||
|
@ -82,15 +82,13 @@ public class ScheduleGenerator {
|
||||
|
||||
int totalDuration = 0;
|
||||
for(ProjectEventTemplate e : eventTemplates){
|
||||
tempPointer = datePointer;
|
||||
tempPointer = new DateMidnight(datePointer);
|
||||
ProjectEvent event = e.createEventFromTemplate();
|
||||
event.setParticipants(project.getProjectParticipants());
|
||||
if(e.getEstimatedTimeConsumption() < 1){
|
||||
event.setParticipants(project.getProjectParticipants());//might have to remove this
|
||||
if(e.getEstimatedTimeConsumption() <= 1){
|
||||
datePointer = new DateMidnight(startDate).plusDays(e.getDaysOffset());
|
||||
}
|
||||
double duration = (double) e.getEstimatedTimeConsumption() * ratio;
|
||||
if(duration < 1.0)
|
||||
duration = 1.0;
|
||||
|
||||
datePointer = datePointer.plusDays((int) duration);
|
||||
totalDuration += (int)duration;
|
||||
@ -104,14 +102,10 @@ public class ScheduleGenerator {
|
||||
}
|
||||
}
|
||||
event.setDueDate(datePointer.toDate());
|
||||
event.setCreator(SciProSession.get().getUser());
|
||||
event.setProjectSchedule(projectSchedule);
|
||||
event = projectEventDao.save(event);
|
||||
events.add(event);
|
||||
|
||||
|
||||
datePointer = tempPointer;
|
||||
System.out.println(event);
|
||||
if(e.getEstimatedTimeConsumption() <= 1){
|
||||
datePointer = tempPointer;
|
||||
}
|
||||
}
|
||||
return new ScheduleGeneratorResult(template, events, totalDuration, templateEstimatedDays, startDate.toDate(), endDate.toDate());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user