diff options
Diffstat (limited to 'lib/tasks/tasks.rake')
-rw-r--r-- | lib/tasks/tasks.rake | 10 |
1 files changed, 10 insertions, 0 deletions
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 @@ | |||
1 | namespace :thoughts do | ||
2 | desc "Email a review of the last day's upvotes" | ||
3 | task :email_upvote_report => :environment do | ||
4 | votes = Vote.where("created_at > ?", 1.day.ago).where(upvote: 1).all | ||
5 | |||
6 | unless votes.empty? | ||
7 | VoteMailer.with(votes: votes).daily_report_email.deliver | ||
8 | end | ||
9 | end | ||
10 | end | ||