issue-23 #24
@ -5,13 +5,10 @@
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="ChangeListManager">
 | 
			
		||||
    <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Delete Schedules">
 | 
			
		||||
      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/AbstractScheduleShortInfo.java" afterDir="false" />
 | 
			
		||||
      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/BasicScheduleShortInfo.java" afterDir="false" />
 | 
			
		||||
      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ScheduleInfo.java" afterDir="false" />
 | 
			
		||||
      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskShortInfo.java" 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/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" afterDir="false" />
 | 
			
		||||
      <change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
 | 
			
		||||
      <change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ScheduleInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ScheduleInfo.java" 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" />
 | 
			
		||||
    </list>
 | 
			
		||||
    <option name="SHOW_DIALOG" value="false" />
 | 
			
		||||
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
 | 
			
		||||
@ -100,7 +97,8 @@
 | 
			
		||||
      <workItem from="1697969480767" duration="6407000" />
 | 
			
		||||
      <workItem from="1697989716016" duration="3814000" />
 | 
			
		||||
      <workItem from="1698067098771" duration="4770000" />
 | 
			
		||||
      <workItem from="1698127431684" duration="1530000" />
 | 
			
		||||
      <workItem from="1698127431684" duration="2039000" />
 | 
			
		||||
      <workItem from="1698164397550" duration="2329000" />
 | 
			
		||||
    </task>
 | 
			
		||||
    <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
 | 
			
		||||
      <option name="closed" value="true" />
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,15 @@
 | 
			
		||||
package core.api.models.timemanager.taskSchedule;
 | 
			
		||||
 | 
			
		||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
			
		||||
import core.api.models.timemanager.tasks.TaskShortInfo;
 | 
			
		||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
			
		||||
import core.entities.timemanager.ScheduleType;
 | 
			
		||||
import core.entities.timemanager.Taskgroup;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class ScheduleInfo {
 | 
			
		||||
 | 
			
		||||
@ -15,22 +19,29 @@ public class ScheduleInfo {
 | 
			
		||||
 | 
			
		||||
    private LocalDateTime finishTime;
 | 
			
		||||
    private int activeMinutes;
 | 
			
		||||
 | 
			
		||||
    private AbstractScheduleShortInfo schedule;
 | 
			
		||||
 | 
			
		||||
    private List<TaskgroupEntityInfo> taskgroupPath;
 | 
			
		||||
 | 
			
		||||
    private TaskShortInfo task;
 | 
			
		||||
 | 
			
		||||
    public ScheduleInfo(BasicTaskSchedule basicTaskSchedule) {
 | 
			
		||||
        this.scheduleID = basicTaskSchedule.getScheduleID();
 | 
			
		||||
        this.scheduleType = ScheduleType.BASIC;
 | 
			
		||||
        this.startTime = basicTaskSchedule.getStartTime();
 | 
			
		||||
        this.finishTime = basicTaskSchedule.getFinishedTime();
 | 
			
		||||
 | 
			
		||||
        if(this.finishTime == null) {
 | 
			
		||||
        if(this.finishTime == null && this.startTime != null) {
 | 
			
		||||
            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), LocalDate.now()).toMinutes();
 | 
			
		||||
        } else {
 | 
			
		||||
        } else if(this.startTime != null){
 | 
			
		||||
            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), basicTaskSchedule.getFinishedTime()).toMinutes();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.schedule = new BasicScheduleShortInfo(basicTaskSchedule);
 | 
			
		||||
        this.task = new TaskShortInfo(basicTaskSchedule.getTask());
 | 
			
		||||
        List<Taskgroup> taskgroupPath = Taskgroup.getAncestorList(basicTaskSchedule.getTask().getTaskgroup());
 | 
			
		||||
        taskgroupPath.add(basicTaskSchedule.getTask().getTaskgroup());
 | 
			
		||||
        this.taskgroupPath = taskgroupPath.stream().map(TaskgroupEntityInfo::new).toList();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getScheduleID() {
 | 
			
		||||
@ -80,4 +91,20 @@ public class ScheduleInfo {
 | 
			
		||||
    public void setSchedule(AbstractScheduleShortInfo schedule) {
 | 
			
		||||
        this.schedule = schedule;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<TaskgroupEntityInfo> getTaskgroupPath() {
 | 
			
		||||
        return taskgroupPath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTaskgroupPath(List<TaskgroupEntityInfo> taskgroupPath) {
 | 
			
		||||
        this.taskgroupPath = taskgroupPath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TaskShortInfo getTask() {
 | 
			
		||||
        return task;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTask(TaskShortInfo task) {
 | 
			
		||||
        this.task = task;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,30 @@
 | 
			
		||||
package core.api.models.timemanager.tasks;
 | 
			
		||||
 | 
			
		||||
import core.entities.timemanager.Task;
 | 
			
		||||
 | 
			
		||||
public class TaskShortInfo {
 | 
			
		||||
 | 
			
		||||
    private long taskID;
 | 
			
		||||
    private String taskName;
 | 
			
		||||
 | 
			
		||||
    public TaskShortInfo(Task task) {
 | 
			
		||||
        this.taskID = task.getTaskID();
 | 
			
		||||
        this.taskName = task.getTaskName();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getTaskID() {
 | 
			
		||||
        return taskID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTaskID(long taskID) {
 | 
			
		||||
        this.taskID = taskID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTaskName() {
 | 
			
		||||
        return taskName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTaskName(String taskName) {
 | 
			
		||||
        this.taskName = taskName;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -33,6 +33,7 @@ model/signUpRequest.ts
 | 
			
		||||
model/simpleStatusResponse.ts
 | 
			
		||||
model/taskEntityInfo.ts
 | 
			
		||||
model/taskFieldInfo.ts
 | 
			
		||||
model/taskShortInfo.ts
 | 
			
		||||
model/taskgroupDetailInfo.ts
 | 
			
		||||
model/taskgroupEntityInfo.ts
 | 
			
		||||
model/taskgroupFieldInfo.ts
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@ export * from './signUpRequest';
 | 
			
		||||
export * from './simpleStatusResponse';
 | 
			
		||||
export * from './taskEntityInfo';
 | 
			
		||||
export * from './taskFieldInfo';
 | 
			
		||||
export * from './taskShortInfo';
 | 
			
		||||
export * from './taskgroupDetailInfo';
 | 
			
		||||
export * from './taskgroupEntityInfo';
 | 
			
		||||
export * from './taskgroupFieldInfo';
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,8 @@
 | 
			
		||||
 * Do not edit the class manually.
 | 
			
		||||
 */
 | 
			
		||||
import { BasicScheduleFieldInfo } from './basicScheduleFieldInfo';
 | 
			
		||||
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
 | 
			
		||||
import { TaskShortInfo } from './taskShortInfo';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export interface ScheduleInfo { 
 | 
			
		||||
@ -34,6 +36,8 @@ export interface ScheduleInfo {
 | 
			
		||||
     */
 | 
			
		||||
    activeMinutes: number;
 | 
			
		||||
    schedule: BasicScheduleFieldInfo;
 | 
			
		||||
    task: TaskShortInfo;
 | 
			
		||||
    taskgroupPath: Array<TaskgroupEntityInfo>;
 | 
			
		||||
}
 | 
			
		||||
export namespace ScheduleInfo {
 | 
			
		||||
    export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										24
									
								
								frontend/src/api/model/taskShortInfo.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								frontend/src/api/model/taskShortInfo.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
/**
 | 
			
		||||
 * API Title
 | 
			
		||||
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
			
		||||
 *
 | 
			
		||||
 * The version of the OpenAPI document: 1.0
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
			
		||||
 * https://openapi-generator.tech
 | 
			
		||||
 * Do not edit the class manually.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export interface TaskShortInfo { 
 | 
			
		||||
    /**
 | 
			
		||||
     * internal id of task
 | 
			
		||||
     */
 | 
			
		||||
    taskID: number;
 | 
			
		||||
    /**
 | 
			
		||||
     * name of task
 | 
			
		||||
     */
 | 
			
		||||
    taskName: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ import {
 | 
			
		||||
  TaskEntityInfo,
 | 
			
		||||
  TaskgroupEntityInfo,
 | 
			
		||||
  TaskgroupService,
 | 
			
		||||
  TaskService
 | 
			
		||||
  TaskService, TaskShortInfo
 | 
			
		||||
} from "../../../api";
 | 
			
		||||
import {ActivatedRoute, Router} from "@angular/router";
 | 
			
		||||
import {CalendarDateFormatter, CalendarEvent, CalendarView} from "angular-calendar";
 | 
			
		||||
@ -49,6 +49,7 @@ export class SchedulerComponent implements OnInit{
 | 
			
		||||
  taskgroup: TaskgroupEntityInfo | undefined
 | 
			
		||||
  taskgroupPath: TaskgroupEntityInfo[] = []
 | 
			
		||||
  taskgroupID: number = -1;
 | 
			
		||||
  scheduleID: number = -1;
 | 
			
		||||
  @ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
 | 
			
		||||
 | 
			
		||||
  task: TaskEntityInfo | undefined
 | 
			
		||||
@ -92,10 +93,14 @@ export class SchedulerComponent implements OnInit{
 | 
			
		||||
          next: resp => {
 | 
			
		||||
            this.task = resp;
 | 
			
		||||
            this.initializeNavigationLinkList()
 | 
			
		||||
            this.fetchBasicSchedules();
 | 
			
		||||
            this.fetschSchedules();
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if(params.has('scheduleID')) {
 | 
			
		||||
        this.scheduleID = Number(params.get('scheduleID'));
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -128,63 +133,40 @@ export class SchedulerComponent implements OnInit{
 | 
			
		||||
    this.refresh.next();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  fetchBasicSchedules() {
 | 
			
		||||
    this.activatedRoute.paramMap.subscribe(params => {
 | 
			
		||||
      if(params.has('scheduleID')) {
 | 
			
		||||
        this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({
 | 
			
		||||
            next: resp => {
 | 
			
		||||
              resp.forEach(basicSchedule => {
 | 
			
		||||
                if(basicSchedule.scheduleID === Number(params.get('scheduleID'))) {
 | 
			
		||||
                  this.events.push({
 | 
			
		||||
                    start: new Date(basicSchedule.scheduleDate),
 | 
			
		||||
                    title: this.computeTaskPath(),
 | 
			
		||||
                    color: colors['yellow'],
 | 
			
		||||
                    allDay: true,
 | 
			
		||||
                  })
 | 
			
		||||
                  this.basicScheduler?.setEditedBasicSchedule(basicSchedule);
 | 
			
		||||
                } else {
 | 
			
		||||
                  this.events.push({
 | 
			
		||||
                    start: new Date(basicSchedule.scheduleDate),
 | 
			
		||||
                    title: this.computeTaskPath(),
 | 
			
		||||
                    color: colors['red'],
 | 
			
		||||
                    allDay: true,
 | 
			
		||||
                  })
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
                this.refresh.next();
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({
 | 
			
		||||
          next: resp => {
 | 
			
		||||
            resp.forEach(basicSchedule => {
 | 
			
		||||
              this.events.push({
 | 
			
		||||
                start: new Date(basicSchedule.scheduleDate),
 | 
			
		||||
                title: this.computeTaskPath(),
 | 
			
		||||
                color: colors['red'],
 | 
			
		||||
                allDay: true,
 | 
			
		||||
              })
 | 
			
		||||
  fetschSchedules() {
 | 
			
		||||
    this.scheduleService.schedulesGet().subscribe({
 | 
			
		||||
      next: resp => {
 | 
			
		||||
        resp.forEach(schedule => {
 | 
			
		||||
          let color: EventColor = colors['red']
 | 
			
		||||
          if(schedule.scheduleID === this.scheduleID) {
 | 
			
		||||
            color = colors['yellow']
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if(schedule.scheduleType === 'BASIC') {
 | 
			
		||||
            this.events.push({
 | 
			
		||||
              start: new Date(schedule.schedule.scheduleDate),
 | 
			
		||||
              title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
 | 
			
		||||
              color: color,
 | 
			
		||||
              allDay: true,
 | 
			
		||||
            })
 | 
			
		||||
            this.refresh.next();
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        this.refresh.next();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  eventClicked({ event }: { event: CalendarEvent }): void {
 | 
			
		||||
    this.router.navigateByUrl("/taskgroups/" + this.taskgroupID.toString() + "/tasks/" + this.task!.taskID )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  computeTaskPath() {
 | 
			
		||||
  computeTaskPath(taskgroupPath: TaskgroupEntityInfo[], task: TaskShortInfo | TaskEntityInfo) {
 | 
			
		||||
    let result = "";
 | 
			
		||||
    this.taskgroupPath.forEach(taskgroupPathPart => {
 | 
			
		||||
    taskgroupPath.forEach(taskgroupPathPart => {
 | 
			
		||||
      result += taskgroupPathPart.taskgroupName + "/"
 | 
			
		||||
    });
 | 
			
		||||
    result += this.taskgroup!.taskgroupName + "/"
 | 
			
		||||
    result += this.task!.taskName
 | 
			
		||||
    result += task!.taskName
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								openapi.yaml
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								openapi.yaml
									
									
									
									
									
								
							@ -1734,6 +1734,8 @@ components:
 | 
			
		||||
        - finishTime
 | 
			
		||||
        - activeMinutes
 | 
			
		||||
        - schedule
 | 
			
		||||
        - task
 | 
			
		||||
        - taskgroupPath
 | 
			
		||||
      additionalProperties: false
 | 
			
		||||
      properties:
 | 
			
		||||
        scheduleID:
 | 
			
		||||
@ -1763,4 +1765,26 @@ components:
 | 
			
		||||
        schedule:
 | 
			
		||||
          type: object
 | 
			
		||||
          oneOf:
 | 
			
		||||
            - $ref: '#/components/schemas/BasicScheduleFieldInfo'
 | 
			
		||||
            - $ref: '#/components/schemas/BasicScheduleFieldInfo'
 | 
			
		||||
        task:
 | 
			
		||||
          type: object
 | 
			
		||||
          $ref: '#/components/schemas/TaskShortInfo'
 | 
			
		||||
        taskgroupPath:
 | 
			
		||||
          type: array
 | 
			
		||||
          items:
 | 
			
		||||
            $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
			
		||||
        
 | 
			
		||||
    TaskShortInfo:
 | 
			
		||||
      required:
 | 
			
		||||
        - taskID
 | 
			
		||||
        - taskName
 | 
			
		||||
      additionalProperties: false
 | 
			
		||||
      properties:
 | 
			
		||||
        taskID:
 | 
			
		||||
          type: number
 | 
			
		||||
          description: internal id of task
 | 
			
		||||
          example: 1
 | 
			
		||||
        taskName:
 | 
			
		||||
          type: string
 | 
			
		||||
          description: name of task
 | 
			
		||||
          example: "Vorlesung zusammenfassen"
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user