module DelayedJobsHelper def print_name(job) case job.name when "Tag.increment_post_counts" "increment post counts" when "Tag.decrement_post_counts" "decrement post counts" when "Post.expire_cache" "expire post cache" when "Moderator::TagBatchChange" "tag batch change" 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" when "Class#remove_iqdb" "remove from iqdb" when "Post#update_iqdb" "update iqdb" when "Class#convert" "convert ugoira" when "Class#increment_post_counts" "increment post counts" when "Class#decrement_post_counts" "decrement post counts" when "Pool#update_category_pseudo_tags_for_posts" "update pool category pseudo tags for posts" when "Post.delete_files" "delete old files" else h(job.name) end end def print_handler(job) case job.name when "Tag.increment_post_counts", "Tag.decrement_post_counts" "" when "Post.expire_cache" "" when "Moderator::TagBatchChange" h(job.payload_object.antecedent) + " -> " + h(job.payload_object.consequent) 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) when "Class#process", "Class#remove_iqdb" h(job.payload_object.args.flatten.join(" ")) when "Post#update_iqdb" h(job.payload_object.id) when "Class#convert" h(job.payload_object.args[0]) when "Class#increment_post_counts" h(job.payload_object.args.join(" ")) when "Class#decrement_post_counts" h(job.payload_object.args.join(" ")) when "Pool#update_category_pseudo_tags_for_posts" %{#{h(job.payload_object.name)}} when "Post.delete_files" %{post ##{job.payload_object.args.first}} else h(job.handler) end end end