about summary refs log tree commit diff stats
path: root/lib/tasks/tasks.rake
blob: fee22f4cec1fe4b059d2d8cab8b9b2f5582f2bfe (plain) (blame)
1
2
3
4
5
6
7
8
9
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