From df0959953191249b1efaeb30dc664d2d06f989ee Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 29 Sep 2017 22:47:03 +0530 Subject: [PATCH] FIX: use different method name for topic rake task https://kevinjalbert.com/defined_methods-in-rake-tasks-you-re-gonna-have-a-bad-time/ cc @gschlager --- lib/tasks/topics.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/topics.rake b/lib/tasks/topics.rake index f0cb196f0e..bbbf56ac79 100644 --- a/lib/tasks/topics.rake +++ b/lib/tasks/topics.rake @@ -1,4 +1,4 @@ -def print_status(label, current, max) +def print_status_with_label(label, current, max) print "\r%s%9d / %d (%5.1f%%)" % [label, current, max, ((current.to_f / max.to_f) * 100).round(1)] end @@ -21,7 +21,7 @@ def close_old_topics(category) topics.find_each do |topic| topic.update_status("closed", true, Discourse.system_user) - print_status(" closing old topics: ", topics_closed += 1, total) + print_status_with_label(" closing old topics: ", topics_closed += 1, total) end end @@ -47,7 +47,7 @@ def apply_auto_close(category) topics.find_each do |topic| topic.inherit_auto_close_from_category - print_status(" applying auto-close to topics: ", topics_closed += 1, total) + print_status_with_label(" applying auto-close to topics: ", topics_closed += 1, total) end end