Handle setting with undefined weight

Related-Bug: #1644461

Change-Id: I49fa28eb9aed96ec7aeed01d9d4d65363fe89d88
This commit is contained in:
Julia Aranovich 2016-12-08 16:47:18 +03:00
parent f85cd7c68a
commit 412f9a29cb
1 changed files with 3 additions and 1 deletions

View File

@ -953,7 +953,9 @@ models.Settings = BaseModel
this.isValid({models});
},
sortAttributes({weight: weight1, label: label1}, {weight: weight2, label: label2}) {
if (weight1 !== weight2) return weight1 - weight2;
if (weight1 !== weight2 && (weight1 || weight2)) {
return (weight1 && weight2) ? weight1 - weight2 : weight1 ? -1 : 1;
}
return utils.natsort(label1, label2);
}
});