From 9681897e9ace534c4559fa9be20aa86af1a42e13 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 10:33:07 -0500 Subject: Add daily upvote email like AO3 kudos --- lib/tasks/tasks.rake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/tasks/tasks.rake (limited to 'lib/tasks/tasks.rake') diff --git a/lib/tasks/tasks.rake b/lib/tasks/tasks.rake new file mode 100644 index 0000000..fee22f4 --- /dev/null +++ b/lib/tasks/tasks.rake @@ -0,0 +1,10 @@ +namespace :thoughts do + desc "Email a review of the last day's upvotes" + task :email_upvote_report => :environment do + votes = Vote.where("created_at > ?", 1.day.ago).where(upvote: 1).all + + unless votes.empty? + VoteMailer.with(votes: votes).daily_report_email.deliver + end + end +end -- cgit 1.4.1