diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-12-10 13:34:38 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-12-10 13:34:38 +0000 |
commit | c03cb9e135ca70f2430dd45363c88662c6575d29 (patch) | |
tree | 7888c7be0f67880012b840dac47419dcac6c090d /app/helpers/timelog_helper.rb | |
parent | 43b245acdc3db14eabbe907c67796712d2769adb (diff) | |
download | redmine-c03cb9e135ca70f2430dd45363c88662c6575d29.tar.gz redmine-c03cb9e135ca70f2430dd45363c88662c6575d29.zip |
shorten long line of TimelogHelper
git-svn-id: http://svn.redmine.org/redmine/trunk@20614 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/timelog_helper.rb')
-rw-r--r-- | app/helpers/timelog_helper.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index d03fc9273..4d6a9d825 100644 --- a/app/helpers/timelog_helper.rb +++ b/app/helpers/timelog_helper.rb @@ -34,9 +34,11 @@ module TimelogHelper collection = [] if time_entry && time_entry.activity && !time_entry.activity.active? - collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] + collection << ["--- #{l(:actionview_instancetag_blank_option)} ---", ''] else - collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default) + unless activities.detect(&:is_default) + collection << ["--- #{l(:actionview_instancetag_blank_option)} ---", ''] + end end activities.each {|a| collection << [a.name, a.id]} collection @@ -44,7 +46,9 @@ module TimelogHelper def user_collection_for_select_options(time_entry) collection = time_entry.assignable_users - collection << time_entry.user if time_entry.user && !collection.include?(time_entry.user) + if time_entry.user && !collection.include?(time_entry.user) + collection << time_entry.user + end principals_options_for_select(collection, time_entry.user_id.to_s) end @@ -88,15 +92,19 @@ module TimelogHelper def report_to_csv(report) Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv| # Column headers - headers = report.criteria.collect {|criteria| l_or_humanize(report.available_criteria[criteria][:label])} + headers = + report.criteria.collect do |criteria| + l_or_humanize(report.available_criteria[criteria][:label]) + end headers += report.periods headers << l(:label_total_time) csv << headers # Content - report_criteria_to_csv(csv, report.available_criteria, report.columns, report.criteria, report.periods, report.hours) + report_criteria_to_csv(csv, report.available_criteria, report.columns, + report.criteria, report.periods, report.hours) # Total row str_total = l(:label_total_time) - row = [ str_total ] + [''] * (report.criteria.size - 1) + row = [str_total] + [''] * (report.criteria.size - 1) total = 0 report.periods.each do |period| sum = sum_hours(select_hours(report.hours, report.columns, period.to_s)) |