Fix wrong date
All checks were successful
Java CI with Maven / build (push) Successful in 46s

This commit is contained in:
Sebastian Böckelmann 2023-11-12 11:58:42 +01:00
parent 48f162ce0b
commit 753227afec
8 changed files with 84 additions and 23 deletions

View File

@ -4,13 +4,13 @@
<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="ScheduleNow test with running advanced Schedule"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Adapt datetime-picker">
<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/entities/timemanager/AdvancedTaskSchedule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/AdvancedTaskSchedule.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$/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$/../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$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/date-time-picker/date-time-picker.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/date-time-picker/date-time-picker.component.ts" 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/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.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" /> <change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list> </list>
@ -223,7 +223,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="4039000" /> <workItem from="1699769541677" duration="6476000" />
</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" />
@ -529,15 +529,29 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1699730764558</updated> <updated>1699730764558</updated>
</task> </task>
<option name="localTasksCounter" value="39" /> <task id="LOCAL-00039" summary="Update values of datetime picker automatically for editing">
<option name="closed" value="true" />
<created>1699783953060</created>
<option name="number" value="00039" />
<option name="presentableId" value="LOCAL-00039" />
<option name="project" value="LOCAL" />
<updated>1699783953060</updated>
</task>
<task id="LOCAL-00040" summary="Adapt datetime-picker">
<option name="closed" value="true" />
<created>1699783968670</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1699783968670</updated>
</task>
<option name="localTasksCounter" value="41" />
<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="Start task now from Taskoverview in Dashboard" />
<MESSAGE value="Load worked minutes when reloading dashboard" />
<MESSAGE value="Check if there is another active schedule when starting task now" /> <MESSAGE value="Check if there is another active schedule when starting task now" />
<MESSAGE value="List missed Schedules" /> <MESSAGE value="List missed Schedules" />
<MESSAGE value="Forget single schedule" /> <MESSAGE value="Forget single schedule" />
@ -561,7 +575,9 @@
<MESSAGE value="Create Datastructures for AdvancedSchedules and create schedules for them" /> <MESSAGE value="Create Datastructures for AdvancedSchedules and create schedules for them" />
<MESSAGE value="Reschedule Advanced Schedules" /> <MESSAGE value="Reschedule Advanced Schedules" />
<MESSAGE value="ScheduleNow test with running advanced Schedule" /> <MESSAGE value="ScheduleNow test with running advanced Schedule" />
<option name="LAST_COMMIT_MESSAGE" value="ScheduleNow test with running advanced Schedule" /> <MESSAGE value="Update values of datetime picker automatically for editing" />
<MESSAGE value="Adapt datetime-picker" />
<option name="LAST_COMMIT_MESSAGE" value="Adapt datetime-picker" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -576,6 +592,11 @@
<line>68</line> <line>68</line>
<option name="timeStamp" value="14" /> <option name="timeStamp" value="14" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
<line>93</line>
<option name="timeStamp" value="16" />
</line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>

View File

@ -44,6 +44,22 @@ public class AdvancedTaskSchedule extends AbstractSchedule {
} }
public LocalDateTime getScheduleStart() {
return scheduleStart;
}
public void setScheduleStart(LocalDateTime scheduleStart) {
this.scheduleStart = scheduleStart;
}
public LocalDateTime getScheduleEnd() {
return scheduleEnd;
}
public void setScheduleEnd(LocalDateTime scheduleEnd) {
this.scheduleEnd = scheduleEnd;
}
@Override @Override
public ScheduleInfo toScheduleInfo() { public ScheduleInfo toScheduleInfo() {
int activeMinutes = calcActiveMinutes(); int activeMinutes = calcActiveMinutes();

View File

@ -89,8 +89,8 @@ public class TaskScheduleService {
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER); return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
} }
schedule.setStartTime(scheduleFieldInfo.getScheduleStartTime()); schedule.setScheduleStart(scheduleFieldInfo.getScheduleStartTime());
schedule.setStopTime(scheduleFieldInfo.getScheduleStopTime()); schedule.setScheduleEnd(scheduleFieldInfo.getScheduleStopTime());
scheduleRepository.save(schedule); scheduleRepository.save(schedule);
return new ServiceResult<>(schedule); return new ServiceResult<>(schedule);
} }

View File

@ -41,3 +41,4 @@ spring.servlet.multipart.max-request-size=4196KB
demo.webapp.jwtSecret=demoWebappSecretKey demo.webapp.jwtSecret=demoWebappSecretKey
demo.webapp.jwtExpirationMS=86400000 demo.webapp.jwtExpirationMS=86400000
spring.jackson.time-zone=UTC

View File

@ -2,6 +2,7 @@ import {Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild} fr
import {MatDatepicker} from "@angular/material/datepicker"; import {MatDatepicker} from "@angular/material/datepicker";
import {NgxMaterialTimepickerComponent, NgxMaterialTimepickerToggleComponent} from "ngx-material-timepicker"; import {NgxMaterialTimepickerComponent, NgxMaterialTimepickerToggleComponent} from "ngx-material-timepicker";
import {FormControl, Validators} from "@angular/forms"; import {FormControl, Validators} from "@angular/forms";
import * as moment from "moment";
@Component({ @Component({
selector: 'app-date-time-picker', selector: 'app-date-time-picker',
@ -45,7 +46,8 @@ export class DateTimePickerComponent implements OnInit, OnChanges{
const [hours, minutes] = time.split(":") const [hours, minutes] = time.split(":")
selectedDate.setHours(parseInt(hours, 10)); selectedDate.setHours(parseInt(hours, 10));
selectedDate.setMinutes(parseInt(minutes, 10)); selectedDate.setMinutes(parseInt(minutes, 10));
this.timeSet.emit(selectedDate); this.timeSet.emit(selectedDate);
} }
} }

View File

@ -18,6 +18,7 @@ import {
TaskgroupEntityInfo TaskgroupEntityInfo
} from "../../../api"; } from "../../../api";
import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.component"; import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.component";
import * as moment from "moment";
@Component({ @Component({
selector: 'app-advanced-scheduler', selector: 'app-advanced-scheduler',
@ -84,6 +85,7 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
this.selectedStartTime = selectedDate; this.selectedStartTime = selectedDate;
this.startTimePicker!.setDateTime(selectedDate); this.startTimePicker!.setDateTime(selectedDate);
this.calcFutureProgress(); this.calcFutureProgress();
} }
@ -130,8 +132,8 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
schedule() { schedule() {
if(this.scheduleInfo == undefined) { if(this.scheduleInfo == undefined) {
this.scheduleService.schedulesTaskIDAdvancedPut(this.task!.taskID, { this.scheduleService.schedulesTaskIDAdvancedPut(this.task!.taskID, {
scheduleStartTime: this.selectedStartTime!.toISOString(), scheduleStartTime: moment(this.selectedStartTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
scheduleStopTime: this.selectedStopTime!.toISOString() scheduleStopTime: moment(this.selectedStopTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
}).subscribe({ }).subscribe({
next: resp => { next: resp => {
this.onSchedule.emit(resp as AdvancedScheduleInfo); this.onSchedule.emit(resp as AdvancedScheduleInfo);
@ -139,11 +141,12 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
}) })
} else { } else {
this.scheduleService.schedulesScheduleIDAdvancedPost(this.scheduleInfo.scheduleID!, { this.scheduleService.schedulesScheduleIDAdvancedPost(this.scheduleInfo.scheduleID!, {
scheduleStartTime: this.selectedStartTime!.toISOString(), scheduleStartTime: moment(this.selectedStartTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
scheduleStopTime: this.selectedStopTime!.toISOString() scheduleStopTime: moment(this.selectedStopTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
}).subscribe({ }).subscribe({
next: resp => { next: resp => {
this.onSchedule.emit(resp as AdvancedScheduleInfo); this.onSchedule.emit(resp as AdvancedScheduleInfo);
console.log("Rescheduled")
} }
}) })
} }

View File

@ -203,6 +203,9 @@ export class SchedulerComponent implements OnInit{
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task), title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color, color: color,
allDay: true, allDay: true,
meta: {
ID: this.scheduleID
}
}) })
this.refresh.next(); this.refresh.next();
} }
@ -225,8 +228,11 @@ export class SchedulerComponent implements OnInit{
return this.task!; return this.task!;
} }
findEventByTaskPath(taskPath: string, advanced: boolean) { findEventByTaskPath(taskPath: string, advanced: boolean, scheduleID: number | undefined) {
const events : CalendarEvent<any>[] = this.events.filter(event => event.title == taskPath); const events : CalendarEvent<any>[] = this.events.filter(event => event.title == taskPath);
if(scheduleID != -1) {
return this.events.find(calendarEvent => calendarEvent.meta.ID == scheduleID);
}
if(advanced) { if(advanced) {
return events.find(calendarEvent => !calendarEvent.allDay) return events.find(calendarEvent => !calendarEvent.allDay)
} else { } else {
@ -235,7 +241,7 @@ export class SchedulerComponent implements OnInit{
} }
eventTimesExternalChange(selectedDate: Date, start: boolean) { eventTimesExternalChange(selectedDate: Date, start: boolean) {
const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(this.taskgroupPath, this.task!), true); const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(this.taskgroupPath, this.task!), true, this.scheduleID);
if(event == undefined) { if(event == undefined) {
if(start) { if(start) {
this.events.push({ this.events.push({
@ -245,6 +251,9 @@ export class SchedulerComponent implements OnInit{
resizable: { resizable: {
beforeStart: true, beforeStart: true,
afterEnd: true afterEnd: true
},
meta: {
ID: -1
} }
}) })
} else { } else {
@ -256,6 +265,9 @@ export class SchedulerComponent implements OnInit{
resizable: { resizable: {
beforeStart: true, beforeStart: true,
afterEnd: true afterEnd: true
},
meta: {
ID: -1
} }
}) })
this.advancedScheduler!.setStartTime(updatedDate); this.advancedScheduler!.setStartTime(updatedDate);
@ -274,7 +286,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), true); const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(schedule.taskgroupPath, schedule.task), true, this.scheduleID);
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),
@ -284,6 +296,9 @@ export class SchedulerComponent implements OnInit{
resizable: { resizable: {
beforeStart: false, beforeStart: false,
afterEnd: false afterEnd: false
},
meta: {
ID: this.scheduleID
} }
}) })
@ -311,6 +326,9 @@ export class SchedulerComponent implements OnInit{
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task), title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color, color: color,
allDay: false, allDay: false,
meta: {
ID: schedule.scheduleID
}
}) })
this.refresh.next(); this.refresh.next();
} }

View File

@ -2487,10 +2487,10 @@ components:
properties: properties:
scheduleStartTime: scheduleStartTime:
type: string type: string
format: date format: date-time
scheduleStopTime: scheduleStopTime:
type: string type: string
format: date format: date-time
AdvancedScheduleFieldInfo: AdvancedScheduleFieldInfo:
required: required:
- scheduleStartTime - scheduleStartTime