diff --git a/app/models/maintenance_tasks/progress.rb b/app/models/maintenance_tasks/progress.rb index e4237860..1487cc49 100644 --- a/app/models/maintenance_tasks/progress.rb +++ b/app/models/maintenance_tasks/progress.rb @@ -27,7 +27,10 @@ def initialize(run) # @return [Integer] if progress can be determined or the Run is stopped. # @return [nil] if progress can't be determined and the Run isn't stopped. def value - @run.tick_count if estimatable? || @run.stopped? + return 0 if @run.completed? && @run.tick_total.to_i.zero? + return @run.tick_count if estimatable? || @run.stopped? + + nil end # The maximum amount of work expected to be done. This is extracted from the @@ -48,7 +51,7 @@ def max # # @return [String] the text for the Run progress. def text - count = @run.tick_count + count = @run.tick_count || 0 total = @run.tick_total if !total? diff --git a/test/helpers/maintenance_tasks/tasks_helper_test.rb b/test/helpers/maintenance_tasks/tasks_helper_test.rb index 9244cd0d..befc308b 100644 --- a/test/helpers/maintenance_tasks/tasks_helper_test.rb +++ b/test/helpers/maintenance_tasks/tasks_helper_test.rb @@ -49,6 +49,20 @@ class TasksHelperTest < ActionView::TestCase assert_equal expected, progress(@run) end + test "#progress returns a