From bf602348441c7e9029e438f1773a68f1d207aeaf Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Mon, 24 Jan 2022 17:37:31 -0400 Subject: [PATCH] Remove check_automation_ids management command --- .../commands/check_automation_ids.py | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 program/management/commands/check_automation_ids.py diff --git a/program/management/commands/check_automation_ids.py b/program/management/commands/check_automation_ids.py deleted file mode 100644 index 825149ea..00000000 --- a/program/management/commands/check_automation_ids.py +++ /dev/null @@ -1,44 +0,0 @@ -import json -from os.path import join - -from django.conf import settings -from django.core.management.base import NoArgsCommand - -from program.models import Schedule - - -class Command(NoArgsCommand): - help = 'checks the automation_ids used by program slots against the exported' - - def handle_noargs(self, **options): - cache_dir = getattr(settings, 'AUTOMATION_CACHE_DIR', 'cache') - cached_shows = join(cache_dir, 'shows.json') - with open(cached_shows) as shows_json: - shows = json.loads(shows_json.read()) - - rd_ids = {} - for show in shows['shows']: - rd_ids[show['id']] = show - for show in shows['multi-shows']: - rd_ids[show['id']] = show - - pv_ids = [] - for schedule in Schedule.objects.filter(automation_id__isnull=False): - pv_ids.append(int(schedule.automation_id)) - - for automation_id in sorted(rd_ids.iterkeys()): - if rd_ids[automation_id]['type'] == 's': - continue - - multi_id = -1 - if 'multi' in rd_ids[automation_id]: - multi_id = rd_ids[automation_id]['multi']['id'] - if automation_id not in pv_ids and multi_id not in pv_ids: - if multi_id < 0: - self.stdout.write(self.style.NOTICE, f'+ {automation_id}') - else: - self.stdout.write(self.style.NOTICE, f'+ {automation_id} ({multi_id})') - - for automation_id in sorted(pv_ids): - if automation_id not in rd_ids: - self.stdout.write(self.style.NOTICE, f'- {automation_id}') -- GitLab