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

@@ -89,11 +89,6 @@ export async function createTasks (req, res, options = {}) {
let taskType = taskData.type;
let newTask = new Tasks[taskType](Tasks.Task.sanitize(taskData));
// Attempt to round priority
if (newTask.priority && !Number.isNaN(Number.parseFloat(newTask.priority))) {
newTask.priority = Number(newTask.priority.toFixed(1));
}
if (challenge) {
newTask.challenge.id = challenge.id;
} else if (group) {