Order tags to search by alphabetically

We were ordering one group of tags alphabetically and then adding
another group of tags which wasn't ordered alphabetically, which didn't
make much sense.
This commit is contained in:
Javi Martín
2019-10-31 21:45:57 +01:00
parent fb2b821c28
commit beae82aae8

View File

@@ -54,9 +54,10 @@ module BudgetsHelper
end
def investment_tags_select_options(budget, context)
tags = budget.investments.tags_on(context).order(:name).pluck(:name)
tags = tags.concat budget.tag_list_on(context)
tags.uniq
taggables = [budget] + budget.investments
Tag.joins(:taggings)
.merge(Tagging.where(taggable: taggables, context: context))
.distinct.order(:name).pluck(:name)
end
def unfeasible_or_unselected_filter