Skip to content
Permalink
Browse files
[JENKINS-31162] Reviewed the ordening applied
  • Loading branch information
recena committed Mar 23, 2016
1 parent 2890ff3 commit f1f1565c4aa0d4abad8447d943d36318bd2c9d27
Showing 2 changed files with 2 additions and 4 deletions.
@@ -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())) {
@@ -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);

0 comments on commit f1f1565

Please sign in to comment.