Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Andrinopoulos <geoandri@gmail.com>2017-11-07 21:57:30 +0300
committerGeorge Andrinopoulos <geoandri@gmail.com>2017-11-07 21:57:30 +0300
commita4d71cba7ef80e6f3c10f148dd1edfbef7f82893 (patch)
tree7e5435a0b7cdbe85c5f5ec8fe8f50951b1e89c27 /lib/milestone_array.rb
parentf4ed780ef5fc76b7704742d4886ac435c3e5ab98 (diff)
Add group milestone to feature spec and minor changes
Diffstat (limited to 'lib/milestone_array.rb')
-rw-r--r--lib/milestone_array.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/milestone_array.rb b/lib/milestone_array.rb
index 9b3f2acc123..4ed8485b36a 100644
--- a/lib/milestone_array.rb
+++ b/lib/milestone_array.rb
@@ -13,7 +13,7 @@ module MilestoneArray
when 'name_asc'
sort_asc(array, 'title')
when 'name_desc'
- sort_desc(array, 'title')
+ sort_asc(array, 'title').reverse
else
array
end
@@ -22,19 +22,19 @@ module MilestoneArray
private
def sort_asc_nulls_last(array, attribute)
- array.select(&attribute.to_sym).sort_by(&attribute.to_sym) + array.reject(&attribute.to_sym)
+ attribute = attribute.to_sym
+
+ array.select(&attribute).sort_by(&attribute) + array.reject(&attribute)
end
def sort_desc_nulls_last(array, attribute)
- array.select(&attribute.to_sym).sort_by(&attribute.to_sym).reverse + array.reject(&attribute.to_sym)
+ attribute = attribute.to_sym
+
+ array.select(&attribute).sort_by(&attribute).reverse + array.reject(&attribute)
end
def sort_asc(array, attribute)
array.sort_by(&attribute.to_sym)
end
-
- def sort_desc(array, attribute)
- array.sort_by(&attribute.to_sym).reverse
- end
end
end