diff --git a/modules/costs/app/components/time_entries/time_entry_form.rb b/modules/costs/app/components/time_entries/time_entry_form.rb index fb1e3ebfed19..4f1014e47e10 100644 --- a/modules/costs/app/components/time_entries/time_entry_form.rb +++ b/modules/costs/app/components/time_entries/time_entry_form.rb @@ -55,7 +55,8 @@ class TimeEntryForm < ApplicationForm f.select_list name: :activity_id, label: TimeEntry.human_attribute_name(:activity), include_blank: true do |list| activities.each do |activity| - list.option(value: activity.id, label: activity.name) + selected = (model.activity_id == activity.id) || (model.activity_id.blank? && activity.is_default?) + list.option(value: activity.id, label: activity.name, selected:) end end