From 1255d0ddc68c02935cd3c90d24effbecdce923d2 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 28 Aug 2024 18:03:30 -0400 Subject: [PATCH] membershipworks: Remove simple-history duplicates every hour --- membershipworks/apps.py | 6 ++++++ membershipworks/tasks/simple_history.py | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 membershipworks/tasks/simple_history.py diff --git a/membershipworks/apps.py b/membershipworks/apps.py index ad1b52e..8f5d214 100644 --- a/membershipworks/apps.py +++ b/membershipworks/apps.py @@ -9,6 +9,7 @@ def post_migrate_callback(sender, **kwargs): from .tasks.event_survey_emails import send_survey_emails from .tasks.scrape import scrape_events, scrape_membershipworks + from .tasks.simple_history import q_clean_duplicate_history from .tasks.ucsAccounts import sync_accounts ensure_scheduled( @@ -32,6 +33,11 @@ def post_migrate_callback(sender, **kwargs): schedule_type=Schedule.HOURLY, ) + ensure_scheduled( + q_clean_duplicate_history, + schedule_type=Schedule.HOURLY, + ) + class MembershipworksConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" diff --git a/membershipworks/tasks/simple_history.py b/membershipworks/tasks/simple_history.py new file mode 100644 index 0000000..895ddbf --- /dev/null +++ b/membershipworks/tasks/simple_history.py @@ -0,0 +1,9 @@ +import django.core.management + +from cmsmanage.django_q2_helper import q_task_group + + +# TODO: this probably should be more global, instead of owned by membershipworks app +@q_task_group("Clean Duplicate History") +def q_clean_duplicate_history(): + django.core.management.call_command("clean_duplicate_history", "--auto")