lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-v2-0.8.12 vs lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-v2-0.8.13
- old
+ new
@@ -56,12 +56,12 @@
fix_option_weights!
end
end
def ordered_options
- options.each_with_index.sort_by do |option, index|
- (option.weight >= 9999) ? [index, index] : [option.weight, index]
- end.map(&:first)
+ options.sort_by.with_index do |option, index|
+ [option.weight, index]
+ end
end
# Quick config helper
# @param conf [Symbol, Array<Symbol>]
# - `:flat` to display in flat mode