lib/ecoportal/api/v2/page/component/action_field.rb in ecoportal-api-v2-0.8.12 vs lib/ecoportal/api/v2/page/component/action_field.rb in ecoportal-api-v2-0.8.13
- old
+ new
@@ -23,12 +23,12 @@
fix_task_weights!
end
end
def ordered_tasks
- actions.each_with_index.sort_by do |task, index|
- (task.weight >= 9999) ? [index, index] : [task.weight, index]
- end.map(&:first)
+ actions.sort_by.with_index do |task, index|
+ [task.weight, index]
+ end
end
# Quick config helper
# @param conf [Symbol, Array<Symbol>]
# - `:requires` required number of completed actions