round priority on update too (#10186)

* round priority on update too

* move the fix to Task sanitizeTransform

* refactor the task.priority parsing
This commit is contained in:
negue
2018-04-14 16:16:25 +02:00
committed by Matteo Pagliazzi
parent a42cb0e3ab
commit 455f7ac59b
4 changed files with 19 additions and 7 deletions

View File

@@ -458,7 +458,6 @@ api.updateTask = {
let oldCheckList = task.checklist;
// we have to convert task to an object because otherwise things don't get merged correctly. Bad for performances?
let [updatedTaskObj] = common.ops.updateTask(task.toObject(), req);
// Sanitize differently user tasks linked to a challenge
let sanitizedObj;
@@ -471,6 +470,7 @@ api.updateTask = {
}
_.assign(task, sanitizedObj);
// console.log(task.modifiedPaths(), task.toObject().repeat === tep)
// repeat is always among modifiedPaths because mongoose changes the other of the keys when using .toObject()
// see https://github.com/Automattic/mongoose/issues/2749
@@ -481,7 +481,6 @@ api.updateTask = {
}
setNextDue(task, user);
let savedTask = await task.save();
if (group && task.group.id && task.group.assignedUsers.length > 0) {