-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add rake task to check and update user status to Subscribe and Unsubscribed - UI fix the navigation bar, paignation and button alignments - Fix the rake task for Blocked users
- Loading branch information
Showing
5 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
namespace :light do | ||
desc 'Checking and updating the User status (Subscribed and Unsubscribed)' | ||
task :update_user_status => :environment do | ||
|
||
# setting status to Unsubscribed for users whose flag 'is_subscribed' is false | ||
# and status is nil | ||
puts "\n\n Unsubscribed Update Status : " | ||
puts Light::User.where(is_subscribed: false, sidekiq_status: nil, is_blocked: false) | ||
.update_all(sidekiq_status: 'Unsubscribed') | ||
puts Light::User.where(is_subscribed: false, sidekiq_status: nil, is_blocked: true) | ||
.update_all(sidekiq_status: 'Unsubscribed') | ||
|
||
# setting status to Subscribed for users whose flag 'is_subscribed' is true | ||
# and status is nil | ||
puts "\n\n Subscribed Update Status : " | ||
puts Light::User.where(is_subscribed: true, sidekiq_status: nil) | ||
.update_all(sidekiq_status: 'Subscribed') | ||
|
||
# change 'web subscription request' status to 'Unsubscribed' | ||
# 1. add previous status into source field | ||
puts "\n\n Change 'web subscription request' status to 'Unsubscribed' : " | ||
web_subscription = Light::User.where(sidekiq_status: 'web subscription request') | ||
puts web_subscription.update_all(source: 'web subscription request') | ||
|
||
# 2. change status to 'Unsubscribed' | ||
puts web_subscription.update_all(sidekiq_status: 'Unsubscribed') | ||
|
||
|
||
# Fix flag 'is_subscribed' and 'is_blocked' for Blocked Users | ||
puts "\n\n Fix flag is_subscribed : " | ||
puts Light::User.where(sidekiq_status: 'Block') | ||
.update_all(is_subscribed: false, is_blocked: true) | ||
|
||
puts Light::User.where(is_subscribed: true, is_blocked: true) | ||
.update_all(is_subscribed: false, sidekiq_status: 'Block') | ||
|
||
puts "\n\n Fix flag is_blocked :" | ||
puts Light::User.where(is_blocked: nil) | ||
.update_all(is_blocked: false) | ||
|
||
def check_status(status) | ||
Light::User.where(sidekiq_status: status).count | ||
end | ||
|
||
# Status wise count of User | ||
puts "\n\n Total no of User Status : " + | ||
"\n Subscribed : #{check_status('Subscribed')}" + | ||
"\n Unsubscribed : #{check_status('Unsubscribed')}" + | ||
"\n New User : #{check_status('new user')}" + | ||
"\n Invalid : #{check_status('Invalid')}" + | ||
"\n Spam : #{check_status('Spam')}" + | ||
"\n Blocked : #{check_status('Block')}" + | ||
"\n Bounced : #{check_status('Bounced')}" + | ||
"\n Opt in User: #{check_status('Opt in mail sent')}" | ||
end | ||
end | ||
|