diff --git a/app/controllers/cost_reports_controller.rb b/app/controllers/cost_reports_controller.rb index 0984ccae70..fb26c3a36a 100644 --- a/app/controllers/cost_reports_controller.rb +++ b/app/controllers/cost_reports_controller.rb @@ -145,7 +145,7 @@ class CostReportsController < ApplicationController cost_type_filter.values.first.to_i if cost_type_filter end - @unit_id = 0 unless @cost_types.include? @unit_id + @unit_id = -1 unless @cost_types.include? @unit_id end # Determine the active cost type, if it is not labor or money, and add a hidden filter to the query diff --git a/lib/widget/cost_types.rb b/lib/widget/cost_types.rb index 7ef879c1b0..6e7b0bee25 100644 --- a/lib/widget/cost_types.rb +++ b/lib/widget/cost_types.rb @@ -31,11 +31,11 @@ class Widget::CostTypes < Widget::Base def contents content_tag :div do - available_cost_type_tabs(@subject).map do |id, label| - type_selection = radio_button_tag("unit", id, id == @selected_type_id) + available_cost_type_tabs(@subject).sort_by { |id, _| id }.map do |id, label| + type_selection = radio_button_tag('unit', id, id == @selected_type_id) type_selection += label_tag "unit_#{id}", h(label) type_selection - end.join("
").html_safe + end.join('
').html_safe end end end