module DelayedJobsHelper
def print_name(job)
case job.name
when "Class#expire_cache"
"expire post count cache"
when "Upload#process!"
"upload post"
when "Tag#update_related"
"update related tags"
when "TagAlias#process!"
"alias"
when "TagImplication#process!"
"implication"
when "Class#clear_cache_for"
"expire tag alias cache"
when "Tag#update_category_cache"
"update tag category cache"
when "Tag#update_category_post_counts"
"update category post counts"
else
h(job.name)
end
end
def print_handler(job)
case job.name
when "Class#expire_cache"
h(job.payload_object.args.flatten.join(" "))
when "Upload#process!"
%{record}
when "Tag#update_related"
h(job.payload_object.name)
when "TagAlias#process!"
h(job.payload_object.antecedent_name) + " -> " + h(job.payload_object.consequent_name)
when "TagImplication#process!"
h(job.payload_object.antecedent_name) + " -> " + h(job.payload_object.consequent_name)
when "Class#clear_cache_for"
h(job.payload_object.args.flatten.join(" "))
when "Tag#update_category_cache"
h(job.payload_object.name)
when "Tag#update_category_post_counts"
h(job.payload_object.name)
else
h(job.handler)
end
end
end