Display already scheduled schedules in scheduler
All checks were successful
Java CI with Maven / build (push) Successful in 44s

This commit is contained in:
Sebastian Böckelmann 2023-11-12 10:35:22 +01:00
parent 6d50e30475
commit 5b62986029
5 changed files with 49 additions and 31 deletions

View File

@ -6,18 +6,10 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="ScheduleNow test with running advanced Schedule"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="ScheduleNow test with running advanced Schedule">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleFieldInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleFieldInfo.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleFieldInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleFieldInfo.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/BasicTaskSchedule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/BasicTaskSchedule.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -228,7 +220,7 @@
<workItem from="1699473376129" duration="1423000" /> <workItem from="1699473376129" duration="1423000" />
<workItem from="1699639316405" duration="9267000" /> <workItem from="1699639316405" duration="9267000" />
<workItem from="1699684493731" duration="1121000" /> <workItem from="1699684493731" duration="1121000" />
<workItem from="1699769541677" duration="1606000" /> <workItem from="1699769541677" duration="2562000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies"> <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" /> <option name="closed" value="true" />

View File

@ -8,28 +8,28 @@ import java.util.List;
public class AdvancedScheduleInfo extends ScheduleInfo { public class AdvancedScheduleInfo extends ScheduleInfo {
private LocalDateTime plannedStartTime; private LocalDateTime scheduleStartTime;
private LocalDateTime plannedStopTime; private LocalDateTime scheduleStopTime;
public AdvancedScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath, LocalDateTime plannedStartTime, LocalDateTime plannedStopTime) { public AdvancedScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath, LocalDateTime plannedStartTime, LocalDateTime plannedStopTime) {
super(scheduleID, scheduleType, startTime, stopTime, activeMinutes, task, taskgroupPath); super(scheduleID, scheduleType, startTime, stopTime, activeMinutes, task, taskgroupPath);
this.plannedStartTime = plannedStartTime; this.scheduleStartTime = plannedStartTime;
this.plannedStopTime = plannedStopTime; this.scheduleStopTime = plannedStopTime;
} }
public LocalDateTime getPlannedStartTime() { public LocalDateTime getScheduleStartTime() {
return plannedStartTime; return scheduleStartTime;
} }
public void setPlannedStartTime(LocalDateTime plannedStartTime) { public void setScheduleStartTime(LocalDateTime scheduleStartTime) {
this.plannedStartTime = plannedStartTime; this.scheduleStartTime = scheduleStartTime;
} }
public LocalDateTime getPlannedStopTime() { public LocalDateTime getScheduleStopTime() {
return plannedStopTime; return scheduleStopTime;
} }
public void setPlannedStopTime(LocalDateTime plannedStopTime) { public void setScheduleStopTime(LocalDateTime scheduleStopTime) {
this.plannedStopTime = plannedStopTime; this.scheduleStopTime = scheduleStopTime;
} }
} }

View File

@ -11,8 +11,10 @@ import java.util.List;
public class BasicScheduleInfo extends ScheduleInfo{ public class BasicScheduleInfo extends ScheduleInfo{
private LocalDate scheduleDate; private LocalDate scheduleDate;
public BasicScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath) {
public BasicScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath, LocalDate scheduleDate) {
super(scheduleID, scheduleType, startTime, stopTime, activeMinutes, task, taskgroupPath); super(scheduleID, scheduleType, startTime, stopTime, activeMinutes, task, taskgroupPath);
this.scheduleDate = scheduleDate;
} }
public BasicScheduleInfo(long scheduleID) { public BasicScheduleInfo(long scheduleID) {

View File

@ -45,7 +45,7 @@ public class BasicTaskSchedule extends AbstractSchedule{
public ScheduleInfo toScheduleInfo() { public ScheduleInfo toScheduleInfo() {
int activeMinutes = calcActiveMinutes(); int activeMinutes = calcActiveMinutes();
List<TaskgroupEntityInfo> taskgroupEntityInfos = Taskgroup.getAncestorList(task.getTaskgroup()).stream().map(TaskgroupEntityInfo::new).toList(); List<TaskgroupEntityInfo> taskgroupEntityInfos = Taskgroup.getAncestorList(task.getTaskgroup()).stream().map(TaskgroupEntityInfo::new).toList();
return new BasicScheduleInfo(scheduleID, ScheduleType.BASIC, startTime, stopTime, activeMinutes, task, taskgroupEntityInfos); return new BasicScheduleInfo(scheduleID, ScheduleType.BASIC, startTime, stopTime, activeMinutes, task, taskgroupEntityInfos, scheduleDate);
} }
@Override @Override

View File

@ -173,10 +173,11 @@ export class SchedulerComponent implements OnInit{
resp.forEach(abstractSchedule => { resp.forEach(abstractSchedule => {
if(abstractSchedule.scheduleType == 'BASIC') { if(abstractSchedule.scheduleType == 'BASIC') {
this.handleFetchedBasicSchedule(abstractSchedule as BasicScheduleInfo) this.handleFetchedBasicSchedule(abstractSchedule as BasicScheduleInfo)
} else if(abstractSchedule.scheduleType == 'ADVANCED') {
this.handleFetchedAdvancedSchedule(abstractSchedule as AdvancedScheduleInfo)
} }
}) })
this.refresh.next();
} }
}) })
} }
@ -194,6 +195,7 @@ export class SchedulerComponent implements OnInit{
color: color, color: color,
allDay: true, allDay: true,
}) })
this.refresh.next();
} }
} }
@ -214,12 +216,17 @@ export class SchedulerComponent implements OnInit{
return this.task!; return this.task!;
} }
findEventByTaskPath(taskPath: string) { findEventByTaskPath(taskPath: string, advanced: boolean) {
return this.events.find(event => event.title == taskPath); const events : CalendarEvent<any>[] = this.events.filter(event => event.title == taskPath);
if(advanced) {
return events.find(calendarEvent => !calendarEvent.allDay)
} else {
return events.find(calendarEvent => calendarEvent.allDay)
}
} }
eventTimesExternalChange(selectedDate: Date, start: boolean) { eventTimesExternalChange(selectedDate: Date, start: boolean) {
const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(this.taskgroupPath, this.task!)); const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(this.taskgroupPath, this.task!), true);
if(event == undefined) { if(event == undefined) {
if(start) { if(start) {
this.events.push({ this.events.push({
@ -258,7 +265,7 @@ export class SchedulerComponent implements OnInit{
} }
onAdvancedSchedule(schedule: AdvancedScheduleInfo) { onAdvancedSchedule(schedule: AdvancedScheduleInfo) {
const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(schedule.taskgroupPath, schedule.task)); const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(schedule.taskgroupPath, schedule.task), true);
if(event == undefined) { if(event == undefined) {
this.events.push({ this.events.push({
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task), title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
@ -278,7 +285,24 @@ export class SchedulerComponent implements OnInit{
beforeStart: false, beforeStart: false,
afterEnd: false afterEnd: false
} }
this.refresh.next();
} }
} }
private handleFetchedAdvancedSchedule(schedule: AdvancedScheduleInfo) {
let color: EventColor = colors['red']
if(schedule.scheduleID === this.scheduleID) {
color = colors['yellow']
}
this.events.push({
start: new Date(schedule.scheduleStartTime),
end: new Date(schedule.scheduleStopTime),
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color,
allDay: false,
})
this.refresh.next();
}
} }