Fix deleting tasks
All checks were successful
Java CI with Maven / build (push) Successful in 1m4s

This commit is contained in:
Sebastian Böckelmann 2023-11-12 17:08:02 +01:00
parent 157126d404
commit 01e3d87026
2 changed files with 24 additions and 20 deletions

View File

@ -4,18 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix wrong date"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Deploy on docker (not productive yet!)">
<change afterPath="$PROJECT_DIR$/../frontend/nginx.conf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../frontend/proxy.conf.json" afterDir="false" />
<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/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../docker-compose.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/Dockerfile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/angular.json" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/angular.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/nginx/nginx.conf.template" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/nginx/run_nginx.sh" beforeDir="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$/../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" />
@ -559,14 +550,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1699786723938</updated> <updated>1699786723938</updated>
</task> </task>
<option name="localTasksCounter" value="42" /> <task id="LOCAL-00042" summary="Deploy on docker (not productive yet!)">
<option name="closed" value="true" />
<created>1699803821051</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1699803821051</updated>
</task>
<option name="localTasksCounter" value="43" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="List missed Schedules" />
<MESSAGE value="Forget single schedule" /> <MESSAGE value="Forget single schedule" />
<MESSAGE value="Fix marking finished task as overdue" /> <MESSAGE value="Fix marking finished task as overdue" />
<MESSAGE value="Write simple Testcase for ci/cd" /> <MESSAGE value="Write simple Testcase for ci/cd" />
@ -591,7 +589,8 @@
<MESSAGE value="Update values of datetime picker automatically for editing" /> <MESSAGE value="Update values of datetime picker automatically for editing" />
<MESSAGE value="Adapt datetime-picker" /> <MESSAGE value="Adapt datetime-picker" />
<MESSAGE value="Fix wrong date" /> <MESSAGE value="Fix wrong date" />
<option name="LAST_COMMIT_MESSAGE" value="Fix wrong date" /> <MESSAGE value="Deploy on docker (not productive yet!)" />
<option name="LAST_COMMIT_MESSAGE" value="Deploy on docker (not productive yet!)" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -611,6 +610,11 @@
<line>93</line> <line>93</line>
<option name="timeStamp" value="16" /> <option name="timeStamp" value="16" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskService.java</url>
<line>92</line>
<option name="timeStamp" value="35" />
</line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>

View File

@ -77,11 +77,6 @@ public class TaskService {
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER); return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
} }
//Check for invalid date (deadline before start
if(taskFieldInfo.getStartDate() != null && taskFieldInfo.getDeadline() != null &&
taskFieldInfo.getDeadline().isBefore(taskFieldInfo.getStartDate())) {
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
}
task.setEta(taskFieldInfo.getEta()); task.setEta(taskFieldInfo.getEta());
task.setStartDate(taskFieldInfo.getStartDate()); task.setStartDate(taskFieldInfo.getStartDate());
task.setDeadline(taskFieldInfo.getDeadline()); task.setDeadline(taskFieldInfo.getDeadline());
@ -91,7 +86,12 @@ public class TaskService {
public void deleteTask(Task task) { public void deleteTask(Task task) {
//taskScheduleService.deleteScheduleByTask(task); //taskScheduleService.deleteScheduleByTask(task);
taskRepository.deleteByTaskID(task.getTaskID()); System.err.println(task.getTaskID());
task.getTaskgroup().getTasks().remove(task);
taskgroupRepository.save(task.getTaskgroup());
task.setTaskgroup(null);
taskRepository.save(task);
taskRepository.delete(task);
} }
public void clearTasks(Taskgroup taskgroup) { public void clearTasks(Taskgroup taskgroup) {