diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-06-20 16:44:27 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-06-20 16:44:27 +0000 |
commit | ce1c1f04b6a2d058d96edcb326e5c3cb337bbc68 (patch) | |
tree | 0a8d29dff6d3be561860f86ba3f192588218d665 /app/models/time_entry_activity.rb | |
parent | bfcb1b0054ce6ab397025622c4e7309bc8e1dbcb (diff) | |
download | redmine-ce1c1f04b6a2d058d96edcb326e5c3cb337bbc68.tar.gz redmine-ce1c1f04b6a2d058d96edcb326e5c3cb337bbc68.zip |
Refactor @TimeEntryActivity.default()@ method (#33914).
Patch by Holger Just.
git-svn-id: https://svn.redmine.org/redmine/trunk@21669 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry_activity.rb')
-rw-r--r-- | app/models/time_entry_activity.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/time_entry_activity.rb b/app/models/time_entry_activity.rb index a0be39469..40505019c 100644 --- a/app/models/time_entry_activity.rb +++ b/app/models/time_entry_activity.rb @@ -24,11 +24,12 @@ class TimeEntryActivity < Enumeration def self.default(project=nil) default_activity = super() - if project.nil? || project.activities.blank? || project.activities.include?(default_activity) + + if default_activity.nil? || project.nil? || project.activities.blank? || project.activities.include?(default_activity) return default_activity end - project.activities.find_by(parent_id: default_activity.id) + project.activities.detect { |activity| activity.parent_id == default_activity.id } end def option_name |