Added float rounding (#9657)

* Added float rounding

* Changed to isNaN
This commit is contained in:
Keith Holliday
2017-12-11 11:48:50 -06:00
committed by GitHub
parent 2570c59130
commit 2bb5751f33
2 changed files with 16 additions and 0 deletions

View File

@@ -86,6 +86,11 @@ 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) {