From 8710dee852c75047ec35f3ea201bb45a6e026eec Mon Sep 17 00:00:00 2001 From: spla Date: Tue, 2 Aug 2022 07:15:00 +0200 Subject: [PATCH] Delete inactives who replied yes to deletion --- delete_inactives.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/delete_inactives.py b/delete_inactives.py index ae4c868..e9e6c8f 100644 --- a/delete_inactives.py +++ b/delete_inactives.py @@ -157,23 +157,21 @@ if __name__ == '__main__': rvm_ruby = os.environ['HOME'] + "/.rbenv/shims/ruby" ############################################################################### - # select users who replied the warning email saying yes to deletion - ############################################################################### + # select and delete users who replied the warning email saying yes to deletion 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' and emailed_at < now() - interval '31 days'" + query += "feedback = 't' and recipient_error = 'f'" delete_inactives(deletion_accepted, query) ############################################################################### - # select users who don't replied to email after 30 days - ############################################################################### + # select and delete users who don't replied to 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 emailed_at < now() - interval '31 days'" + query += "feedback = 'f' and recipient_error = 'f' and elapsed_days = '31'" delete_inactives(deletion_accepted, query)