From c53f31079c9d5e5ccdb4f02c7a50082ceb5a4644 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sat, 19 Sep 2026 15:14:00 +0900 Subject: [PATCH] Don't display 0.00 in the Spent time and Total spent time columns of the issue list when no time is logged --- app/helpers/queries_helper.rb | 4 ++-- test/functional/issues_controller_test.rb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 5b86413b4..5a5e591fe 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -275,9 +275,9 @@ module QueriesHelper when :hours, :estimated_hours, :total_estimated_hours, :estimated_remaining_hours format_hours(value) when :spent_hours - link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}")) + value > 0 ? link_to(format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}")) : '' when :total_spent_hours - link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}")) + value > 0 ? link_to(format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}")) : '' when :attachments value.to_a.map {|a| format_object(a)}.join(" ").html_safe when :watcher_users diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 7e67745ce..2fbe70583 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1390,7 +1390,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal ['4:00', '3:00', '0:00'], columns_values_in_list('spent_hours').first(3) + assert_equal ['4:00', '3:00', ''], columns_values_in_list('spent_hours').first(3) Project.find(3).disable_module!(:time_tracking) get( :index, @@ -1400,7 +1400,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal ['3:00', '0:00', '0:00'], columns_values_in_list('spent_hours').first(3) + assert_equal ['3:00', '', ''], columns_values_in_list('spent_hours').first(3) end def test_index_sort_by_total_spent_hours @@ -1624,6 +1624,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_select 'table.issues tr#issue-3 td.spent_hours', :text => '1:00' + assert_select 'table.issues tr#issue-2 td.spent_hours', :text => '' end def test_index_with_total_spent_hours_column @@ -1636,6 +1637,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_select 'table.issues tr#issue-3 td.total_spent_hours', :text => '1:00' + assert_select 'table.issues tr#issue-2 td.total_spent_hours', :text => '' end def test_index_with_total_estimated_hours_column -- 2.55.0