mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
fix(z-task-modal): fix edgecase for employees, where employee in the middle is not enterd
This commit is contained in:
1 parent
3f75f9d204
commit
6a550006d9
1 file changed
+24
-16
@@ -675,23 +675,31 @@ export default {
|
|||||||
this.$store.commit('tm/update_subtask', subtask);
|
this.$store.commit('tm/update_subtask', subtask);
|
||||||
this.$events.emit('on-subtask-edited', this.subtask);
|
this.$events.emit('on-subtask-edited', this.subtask);
|
||||||
} else {
|
} else {
|
||||||
this.subtask.employees.forEach((employee) => {
|
// Filter out employees that don't have both id and duration
|
||||||
if (employee.id)
|
const validEmployees = this.subtask.employees.filter(
|
||||||
employee.timeblocks = this.timeblocks
|
(employee) => employee.id && employee.duration,
|
||||||
.filter((timeblock) => timeblock.date)
|
);
|
||||||
.map((timeblock) => {
|
|
||||||
return {
|
validEmployees.forEach((employee) => {
|
||||||
start: `${moment(timeblock.date).format('YYYY-MM-DD')} ${
|
employee.timeblocks = this.timeblocks
|
||||||
timeblock.starts_at_time
|
.filter((timeblock) => timeblock.date)
|
||||||
}:00`,
|
.map((timeblock) => {
|
||||||
end: `${moment(timeblock.date).format('YYYY-MM-DD')} ${
|
return {
|
||||||
timeblock.ends_at_time
|
start: `${moment(timeblock.date).format('YYYY-MM-DD')} ${
|
||||||
}:00`,
|
timeblock.starts_at_time
|
||||||
id: null,
|
}:00`,
|
||||||
};
|
end: `${moment(timeblock.date).format('YYYY-MM-DD')} ${
|
||||||
});
|
timeblock.ends_at_time
|
||||||
|
}:00`,
|
||||||
|
id: null,
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const subtaskCopy = this.subtask;
|
|
||||||
|
const subtaskCopy = {
|
||||||
|
...this.subtask,
|
||||||
|
employees: validEmployees,
|
||||||
|
};
|
||||||
delete subtaskCopy._master_task;
|
delete subtaskCopy._master_task;
|
||||||
const { subtasks } = await this.$axios.post_auth(
|
const { subtasks } = await this.$axios.post_auth(
|
||||||
`v1/mastertasks/${this.subtask.master_task_id}/subtasks`,
|
`v1/mastertasks/${this.subtask.master_task_id}/subtasks`,
|
||||||
|
|||||||
Reference in new issue
Block a user