diff --git a/README.md b/README.md index 5bc3eca..fc397d5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Within Python Virtual Environment: 4. Use your favourite scheduling method to set mailing.py to run regularly. Column 'elapsed_days' of mailing's database will be updated so you can decide actions after some time. -5. Run `python delete_inactives.py` to delete all inactive users after 30 days period from the warning email. +5. Run `python delete_inactives.py` to delete all inactive users who replied yes to deletion and all the rest with no feedback after 31 days period from the warning email. 6. Run `python edit_status.py` to set True or False any of following `mailing_db_table` columns: `to_be_deleted`, `feedback` and `recipient_error`. Useful after emailed user's feedback. diff --git a/delete_inactives.py b/delete_inactives.py index e9e6c8f..08f6e5a 100644 --- a/delete_inactives.py +++ b/delete_inactives.py @@ -161,17 +161,15 @@ if __name__ == '__main__': deletion_accepted = True - query = "select account_id, username, email, to_be_deleted, feedback, recipient_error, elapsed_days from " + mailing_db_table + " where to_be_deleted = 't' and " - query += "feedback = 't' and recipient_error = 'f'" + query = "select account_id, username, email, to_be_deleted, feedback, recipient_error, elapsed_days from " + mailing_db_table + " where to_be_deleted and feedback" delete_inactives(deletion_accepted, query) ############################################################################### - # select and delete users who don't replied to email after 31 days + # select and delete users who don't replied the email after 31 days deletion_accepted = False - query = "select account_id, username, email, to_be_deleted, feedback, recipient_error, elapsed_days from " + mailing_db_table + " where to_be_deleted = 'f' and " - query += "feedback = 'f' and recipient_error = 'f' and elapsed_days = '31'" + query = "select account_id, username, email, to_be_deleted, feedback, recipient_error, elapsed_days from " + mailing_db_table + " where not feedback and elapsed_days = '31'" delete_inactives(deletion_accepted, query)