bug/829 Fix unable to edit twice a task due to wrong modification date format
This commit is contained in:
parent
acae3e633b
commit
999ccfde3d
|
@ -48,7 +48,7 @@ public class SampleDataGenerator {
|
||||||
|
|
||||||
private static final String RELATIVE_DATE_REGEX = "RELATIVE_DATE\\((-?\\d+)\\)";
|
private static final String RELATIVE_DATE_REGEX = "RELATIVE_DATE\\((-?\\d+)\\)";
|
||||||
private static final Pattern RELATIVE_DATE_PATTERN = Pattern.compile(RELATIVE_DATE_REGEX);
|
private static final Pattern RELATIVE_DATE_PATTERN = Pattern.compile(RELATIVE_DATE_REGEX);
|
||||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
private ScriptRunner runner;
|
private ScriptRunner runner;
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class TaskControllerIntTest {
|
||||||
String created = jsonNode.get("created").asText();
|
String created = jsonNode.get("created").asText();
|
||||||
assertFalse(response.contains("\"attachments\":[]"));
|
assertFalse(response.contains("\"attachments\":[]"));
|
||||||
assertTrue(
|
assertTrue(
|
||||||
created.matches("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)"));
|
created.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -60,12 +60,7 @@ export class TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getTask(id: string): Observable<Task> {
|
getTask(id: string): Observable<Task> {
|
||||||
return this.httpClient.get<Task>(`${this.url}/${id}`)
|
return this.httpClient.get<Task>(`${this.url}/${id}`);
|
||||||
.pipe(map(
|
|
||||||
(response: Task) => {
|
|
||||||
response = this.applyTaskDatesTimeZone(response);
|
|
||||||
return response;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
completeTask(id: string): Observable<Task> {
|
completeTask(id: string): Observable<Task> {
|
||||||
|
@ -93,16 +88,6 @@ export class TaskService {
|
||||||
return this.httpClient.post<Task>(this.url, task);
|
return this.httpClient.post<Task>(this.url, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyTaskDatesTimeZone(task: Task): Task {
|
|
||||||
if (task.due) { task.due = TaskanaDate.applyTimeZone(task.due); }
|
|
||||||
if (task.modified) { task.modified = TaskanaDate.applyTimeZone(task.modified); }
|
|
||||||
if (task.completed) { task.completed = TaskanaDate.applyTimeZone(task.completed); }
|
|
||||||
if (task.planned) { task.planned = TaskanaDate.applyTimeZone(task.planned); }
|
|
||||||
if (task.claimed) { task.claimed = TaskanaDate.applyTimeZone(task.claimed); }
|
|
||||||
if (task.created) { task.created = TaskanaDate.applyTimeZone(task.created); }
|
|
||||||
return task;
|
|
||||||
}
|
|
||||||
|
|
||||||
private convertTasksDatesToGMT(task: Task): Task {
|
private convertTasksDatesToGMT(task: Task): Task {
|
||||||
if (task.created) { task.created = new Date(task.created).toISOString(); }
|
if (task.created) { task.created = new Date(task.created).toISOString(); }
|
||||||
if (task.claimed) { task.claimed = new Date(task.claimed).toISOString(); }
|
if (task.claimed) { task.claimed = new Date(task.claimed).toISOString(); }
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<span class="float-right pull-right material-icons md-20 blue">{{accordion2State?
|
<span class="float-right pull-right material-icons md-20 blue">{{accordion2State?
|
||||||
'expand_more':'expand_less'}}</span>
|
'expand_more':'expand_less'}}</span>
|
||||||
</button>
|
</button>
|
||||||
<taskana-general-fields-extension [task]="task"></taskana-general-fields-extension>
|
<taskana-general-fields-extension [task]="taskClone"></taskana-general-fields-extension>
|
||||||
</accordion-group>
|
</accordion-group>
|
||||||
<accordion-group panelClass="customClass" (isOpenChange)="accordion3State = $event">
|
<accordion-group panelClass="customClass" (isOpenChange)="accordion3State = $event">
|
||||||
<button class="btn btn-block clearfix" accordion-heading>
|
<button class="btn btn-block clearfix" accordion-heading>
|
||||||
|
|
|
@ -131,6 +131,29 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
this.router.navigate(['./'], {relativeTo: this.route.parent});
|
this.router.navigate(['./'], {relativeTo: this.route.parent});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private applyTaskDatesTimeZone(task: Task): Task {
|
||||||
|
if (task.due) {
|
||||||
|
task.due = TaskanaDate.applyTimeZone(task.due);
|
||||||
|
}
|
||||||
|
if (task.modified) {
|
||||||
|
task.modified = TaskanaDate.applyTimeZone(task.modified);
|
||||||
|
}
|
||||||
|
if (task.completed) {
|
||||||
|
task.completed = TaskanaDate.applyTimeZone(task.completed);
|
||||||
|
}
|
||||||
|
if (task.planned) {
|
||||||
|
task.planned = TaskanaDate.applyTimeZone(task.planned);
|
||||||
|
}
|
||||||
|
if (task.claimed) {
|
||||||
|
task.claimed = TaskanaDate.applyTimeZone(task.claimed);
|
||||||
|
}
|
||||||
|
if (task.created) {
|
||||||
|
task.created = TaskanaDate.applyTimeZone(task.created);
|
||||||
|
}
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
private onSave() {
|
private onSave() {
|
||||||
this.currentId === 'new-task' ? this.createTask() : this.updateTask();
|
this.currentId === 'new-task' ? this.createTask() : this.updateTask();
|
||||||
}
|
}
|
||||||
|
@ -176,12 +199,22 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
this.taskClone.customAttributes = this.task.customAttributes.slice(0);
|
this.taskClone.customAttributes = this.task.customAttributes.slice(0);
|
||||||
this.taskClone.callbackInfo = this.task.callbackInfo.slice(0);
|
this.taskClone.callbackInfo = this.task.callbackInfo.slice(0);
|
||||||
this.taskClone.primaryObjRef = {...this.task.primaryObjRef};
|
this.taskClone.primaryObjRef = {...this.task.primaryObjRef};
|
||||||
|
this.taskClone = this.applyTaskDatesTimeZone(this.taskClone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.routeSubscription) { this.routeSubscription.unsubscribe(); }
|
if (this.routeSubscription) {
|
||||||
if (this.workbasketSubscription) { this.workbasketSubscription.unsubscribe(); }
|
this.routeSubscription.unsubscribe();
|
||||||
if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); }
|
}
|
||||||
if (this.deleteTaskSubscription) { this.deleteTaskSubscription.unsubscribe(); }
|
if (this.workbasketSubscription) {
|
||||||
|
this.workbasketSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.masterAndDetailSubscription) {
|
||||||
|
this.masterAndDetailSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.deleteTaskSubscription) {
|
||||||
|
this.deleteTaskSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue