Skip to content

Commit

Permalink
[JENKINS-31162] Reviewed the ordening applied
Browse files Browse the repository at this point in the history
  • Loading branch information
recena committed Mar 23, 2016
1 parent 2890ff3 commit f1f1565
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Expand Up @@ -65,7 +65,7 @@ public int getWeight() {
*/
@Nonnull
public static ItemCategory getCategory(TopLevelItemDescriptor descriptor) {
int weight = 1;
int weight = 0;
ExtensionList<ItemCategory> categories = ExtensionList.lookup(ItemCategory.class);
for (ItemCategory category : categories) {
if (category.getId().equals(descriptor.getCategoryId())) {
Expand Down
4 changes: 1 addition & 3 deletions war/src/main/js/add-item.js
Expand Up @@ -170,9 +170,7 @@ $.when(getItems()).done(function(data){
}
function sortItemsByOrder(itemTypes) {
function sortByOrder(a, b) {
var result = (a.weight - b.weight);
result = Math.max(result, -1); // If lt than -1, make it -1
result = Math.min(result, +1); // If gt than +1, make it +1
var result = (b.weight - a.weight);
return result;
}
return itemTypes.sort(sortByOrder);
Expand Down

0 comments on commit f1f1565

Please sign in to comment.