From 8ae0c0c5f95e7223d531e499ad4b832abd0755dd Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Thu, 10 Nov 2022 10:18:02 +0100 Subject: [PATCH] better protected against database failing entries with long unaliased status could cause problem in future with new aliases --- .../obtain_livestream_data_and_load_into_database.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etl/planning_data/obtain_livestream_data_and_load_into_database.py b/etl/planning_data/obtain_livestream_data_and_load_into_database.py index af5b6ae9..3974835c 100644 --- a/etl/planning_data/obtain_livestream_data_and_load_into_database.py +++ b/etl/planning_data/obtain_livestream_data_and_load_into_database.py @@ -261,6 +261,10 @@ def obtain_entry_link(provided_link, application_id): def process_status(status, decision_date): + status_length_limit = 50 # see migrations/034.planning_livestream_data.up.sql + if len(status) > status_length_limit: + print("Status was too long and was skipped:", status) + return None """return None if status is invalid""" if status in ["Application Under Consideration", "Application Received"]: if decision_date == None: @@ -280,10 +284,6 @@ def process_status(status, decision_date): print("Unexpected status " + status) if status not in ["No Objection to Proposal (OBS only)", "Objection Raised to Proposal (OBS only)", "Not Required", "Unknown", "Lapsed", "SECS", "Comment Issued", "ALL DECISIONS ISSUED", "Closed", "Declined to Determine"]: print("New unexpected status " + status) - status_length_limit = 50 # see migrations/033.planning_livestream_data.up.sql - if len(status) > 50: - print("Status was too long and was skipped:", status) - return None return status