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" />
</component>
<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$/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$/../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$/../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/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$/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/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/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$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list>
@ -223,7 +223,7 @@
<workItem from="1699473376129" duration="1423000" />
<workItem from="1699639316405" duration="9267000" />
<workItem from="1699684493731" duration="1121000" />
<workItem from="1699769541677" duration="4039000" />
<workItem from="1699769541677" duration="6476000" />
</task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" />
@ -529,15 +529,29 @@
<option name="project" value="LOCAL" />
<updated>1699730764558</updated>
</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 />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<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="List missed Schedules" />
<MESSAGE value="Forget single schedule" />
@ -561,7 +575,9 @@
<MESSAGE value="Create Datastructures for AdvancedSchedules and create schedules for them" />
<MESSAGE value="Reschedule Advanced Schedules" />
<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 name="XDebuggerManager">
<breakpoint-manager>
@ -576,6 +592,11 @@
<line>68</line>
<option name="timeStamp" value="14" />
</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>
</breakpoint-manager>
</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
public ScheduleInfo toScheduleInfo() {
int activeMinutes = calcActiveMinutes();

View File

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

View File

@ -40,4 +40,5 @@ spring.servlet.multipart.max-file-size=4196KB
spring.servlet.multipart.max-request-size=4196KB
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 {NgxMaterialTimepickerComponent, NgxMaterialTimepickerToggleComponent} from "ngx-material-timepicker";
import {FormControl, Validators} from "@angular/forms";
import * as moment from "moment";
@Component({
selector: 'app-date-time-picker',
@ -45,7 +46,8 @@ export class DateTimePickerComponent implements OnInit, OnChanges{
const [hours, minutes] = time.split(":")
selectedDate.setHours(parseInt(hours, 10));
selectedDate.setMinutes(parseInt(minutes, 10));
this.timeSet.emit(selectedDate);
}
}

View File

@ -18,6 +18,7 @@ import {
TaskgroupEntityInfo
} from "../../../api";
import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.component";
import * as moment from "moment";
@Component({
selector: 'app-advanced-scheduler',
@ -84,6 +85,7 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
this.selectedStartTime = selectedDate;
this.startTimePicker!.setDateTime(selectedDate);
this.calcFutureProgress();
}
@ -130,8 +132,8 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
schedule() {
if(this.scheduleInfo == undefined) {
this.scheduleService.schedulesTaskIDAdvancedPut(this.task!.taskID, {
scheduleStartTime: this.selectedStartTime!.toISOString(),
scheduleStopTime: this.selectedStopTime!.toISOString()
scheduleStartTime: moment(this.selectedStartTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
scheduleStopTime: moment(this.selectedStopTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
}).subscribe({
next: resp => {
this.onSchedule.emit(resp as AdvancedScheduleInfo);
@ -139,11 +141,12 @@ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
})
} else {
this.scheduleService.schedulesScheduleIDAdvancedPost(this.scheduleInfo.scheduleID!, {
scheduleStartTime: this.selectedStartTime!.toISOString(),
scheduleStopTime: this.selectedStopTime!.toISOString()
scheduleStartTime: moment(this.selectedStartTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
scheduleStopTime: moment(this.selectedStopTime!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
}).subscribe({
next: resp => {
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),
color: color,
allDay: true,
meta: {
ID: this.scheduleID
}
})
this.refresh.next();
}
@ -225,8 +228,11 @@ export class SchedulerComponent implements OnInit{
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);
if(scheduleID != -1) {
return this.events.find(calendarEvent => calendarEvent.meta.ID == scheduleID);
}
if(advanced) {
return events.find(calendarEvent => !calendarEvent.allDay)
} else {
@ -235,7 +241,7 @@ export class SchedulerComponent implements OnInit{
}
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(start) {
this.events.push({
@ -245,6 +251,9 @@ export class SchedulerComponent implements OnInit{
resizable: {
beforeStart: true,
afterEnd: true
},
meta: {
ID: -1
}
})
} else {
@ -256,6 +265,9 @@ export class SchedulerComponent implements OnInit{
resizable: {
beforeStart: true,
afterEnd: true
},
meta: {
ID: -1
}
})
this.advancedScheduler!.setStartTime(updatedDate);
@ -274,7 +286,7 @@ export class SchedulerComponent implements OnInit{
}
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) {
this.events.push({
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
@ -284,6 +296,9 @@ export class SchedulerComponent implements OnInit{
resizable: {
beforeStart: false,
afterEnd: false
},
meta: {
ID: this.scheduleID
}
})
@ -311,6 +326,9 @@ export class SchedulerComponent implements OnInit{
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color,
allDay: false,
meta: {
ID: schedule.scheduleID
}
})
this.refresh.next();
}

View File

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