Work also with start schedule based on last minute

This commit is contained in:
Sebastian 2023-10-29 09:56:32 +01:00
parent 2324976bd6
commit 5aacf720d0
3 changed files with 22 additions and 21 deletions

View File

@ -5,23 +5,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Load worked minutes when reloading dashboard"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Load worked minutes when reloading dashboard">
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ForgottenActivity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ForgottenActivityMode.java" 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/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/controller/TaskController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskShortInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskShortInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.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/repositories/timemanager/TaskRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/TaskRepository.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/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/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/task.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/task.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/dashboard/active-schedule/active-schedule.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/active-schedule/active-schedule.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/active-schedule/active-schedule.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/active-schedule/active-schedule.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" />
@ -295,6 +281,11 @@
<line>94</line> <line>94</line>
<option name="timeStamp" value="6" /> <option name="timeStamp" value="6" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
<line>202</line>
<option name="timeStamp" value="10" />
</line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>

View File

@ -200,14 +200,17 @@ public class TaskScheduleService {
basicTaskSchedule.setFinishedTime(timeReference); basicTaskSchedule.setFinishedTime(timeReference);
basicTaskScheduleRepository.save(basicTaskSchedule); basicTaskScheduleRepository.save(basicTaskSchedule);
taskRepository.save(task); taskRepository.save(task);
new ServiceResult<>(minutesSpent); return new ServiceResult<>(minutesSpent);
} }
} }
case PLANNED -> { case PLANNED -> {
//Does not make sense until advanced schedule/moderate schedule is implemented //Does not make sense until advanced schedule/moderate schedule is implemented
return new ServiceResult<>(0); return new ServiceResult<>(0);
} }
} default -> {
throw new RuntimeException("INVALID MODE"); throw new RuntimeException("INVALID MODE");
} }
} }
}
}

View File

@ -1,10 +1,11 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ScheduleService, TaskService, TaskShortInfo} from "../../../api"; import {ForgottenActivityRequest, ScheduleService, TaskService, TaskShortInfo} from "../../../api";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
import {DialogRef} from "@angular/cdk/dialog"; import {DialogRef} from "@angular/cdk/dialog";
import {MatDialogRef} from "@angular/material/dialog"; import {MatDialogRef} from "@angular/material/dialog";
import {filter, map, Observable, startWith} from "rxjs"; import {filter, map, Observable, startWith} from "rxjs";
import {FormControl} from "@angular/forms"; import {FormControl} from "@angular/forms";
import ModeEnum = ForgottenActivityRequest.ModeEnum;
@Component({ @Component({
selector: 'app-forgotten-task-start-dialog', selector: 'app-forgotten-task-start-dialog',
@ -53,7 +54,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
const task = this.tasks.find(task => task.taskName === this.myControl.value); const task = this.tasks.find(task => task.taskName === this.myControl.value);
if(task != undefined) { if(task != undefined) {
this.scheduleService.schedulesTaskIDForgottenPost(task.taskID, { this.scheduleService.schedulesTaskIDForgottenPost(task.taskID, {
mode: "MANUAL", mode: this.determineRegisterMode(),
minutesSpent: this.minutesSpentControl.value minutesSpent: this.minutesSpentControl.value
}).subscribe({ }).subscribe({
next: resp => { next: resp => {
@ -74,7 +75,13 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
} }
} }
private determineRegisterMode(): string { private determineRegisterMode(): ModeEnum {
if(this.lastSchedule) {
return "LAST";
} else if(this.plannedSchedule) {
return "PLANNED";
} else {
return "MANUAL"; return "MANUAL";
} }
} }
}