schedule-refactor #45

Merged
sebastian merged 18 commits from schedule-refactor into master 2023-11-11 18:56:16 +01:00
3 changed files with 7 additions and 27 deletions
Showing only changes of commit 4d532c4dbc - Show all commits

View File

@ -13,21 +13,12 @@
export interface ForgottenActivityRequest { export interface ForgottenActivityRequest {
/** /**
* mode of register forgotten activity * time the schedule was started
*/ */
mode: ForgottenActivityRequest.ModeEnum; startTime: string;
/** /**
* number of minutes spent on task * time the schedule was stopped
*/ */
minutesSpent?: number; endTime: string;
}
export namespace ForgottenActivityRequest {
export type ModeEnum = 'MANUAL' | 'LAST' | 'PLANNED';
export const ModeEnum = {
Manual: 'MANUAL' as ModeEnum,
Last: 'LAST' as ModeEnum,
Planned: 'PLANNED' as ModeEnum
};
} }

View File

@ -25,7 +25,7 @@
<div mat-dialog-actions align="end"> <div mat-dialog-actions align="end">
<button mat-raised-button>Cancel</button> <button mat-raised-button>Cancel</button>
<button mat-raised-button color="primary" (click)="registerActivity()">Register</button> <button mat-raised-button color="primary" (click)="registerActivity()" [disabled]="true">Register</button>
</div> </div>

View File

@ -5,7 +5,6 @@ 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 +52,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
registerActivity() { registerActivity() {
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: this.determineRegisterMode(), mode: this.determineRegisterMode(),
minutesSpent: this.minutesSpentControl.value minutesSpent: this.minutesSpentControl.value
}).subscribe({ }).subscribe({
@ -71,17 +70,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
this.snackbar.open("Unexpected error", "", {duration: 2000}); this.snackbar.open("Unexpected error", "", {duration: 2000});
} }
} }
}) })*/
}
}
private determineRegisterMode(): ModeEnum {
if(this.lastSchedule) {
return "LAST";
} else if(this.plannedSchedule) {
return "PLANNED";
} else {
return "MANUAL";
} }
} }
} }