From 7cb51840b5113103dac52b51a045f74e2d814c73 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Fri, 5 Apr 2019 17:03:11 +0100 Subject: [PATCH] Ignore services where an organisation was not found. --- app/commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/commands.py b/app/commands.py index e2ce458d2..b3bbca503 100644 --- a/app/commands.py +++ b/app/commands.py @@ -779,6 +779,7 @@ def associate_services_to_organisations(): created_by_user = User.query.filter_by(id=s.created_by_id).first() organisation = dao_get_organisation_by_email_address(created_by_user.email_address) service = dao_fetch_service_by_id(service_id=s.id) - dao_add_service_to_organisation(service=service, organisation_id=organisation.id) + if organisation: + dao_add_service_to_organisation(service=service, organisation_id=organisation.id) print("finished associating services to organisations")