Skip to content
This repository was archived by the owner on Mar 29, 2022. It is now read-only.

Commit 453e885

Browse files
committed
Use puts instead of rails logger
1 parent c8cc8b6 commit 453e885

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/tasks/gifts.rake

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
namespace :gift do
4+
# TODO: Update this rake task to reflect giving users any remaining available
5+
# shirt coupons when that is implemented in `CouponService`
6+
desc 'gift remaining stickers to incompleted users'
7+
task stickers: :environment do
8+
sticker_coupon_count = StickerCoupon.where(user_id: nil).count
9+
10+
incompleted_user_count = User.where(state: 'incompleted').count
11+
12+
message = "There are #{sticker_coupon_count} stickers remaining.
13+
There are #{incompleted_user_count} users who are incompleted
14+
and eligible for gift_sticker.
15+
16+
Do you want to gift the remaining coupons to incompleted users? (y/n)"
17+
18+
puts message
19+
20+
input = STDIN.gets.strip
21+
22+
if input == 'y'
23+
puts 'Gifting coupons...'
24+
GiftService.call
25+
else
26+
puts 'Terminating.'
27+
end
28+
end
29+
end

0 commit comments

Comments
 (0)