From 8c77255fc4bba492578041d760c8ffcb44383b07 Mon Sep 17 00:00:00 2001 From: through-your-tears Date: Sat, 6 Apr 2024 21:32:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B3=20=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/organizations/services.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/organizations/services.py b/src/organizations/services.py index 58943ac..cb4f074 100644 --- a/src/organizations/services.py +++ b/src/organizations/services.py @@ -42,17 +42,15 @@ MAPPING_DATA = { def parse_organizations_to_db(data): for k in data.keys(): for obj in data[k]: - try: - OrganizationRepository.create( - location=LocationRepository.get_or_create( - coords=Point(obj['latitude'], obj['longitude']), - address=obj['street'] + obj['housenumber'] - ), - name=obj['name'], - phone=obj['phone'], - website=obj['website'], - description=obj['description'], - category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']]) - ) - except Exception: - pass + OrganizationRepository.create( + location=LocationRepository.get_or_create( + coords=Point(obj['latitude'], obj['longitude']), + address=obj['street'] + obj['housenumber'] + ), + name=obj['name'], + phone=obj['phone'], + website=obj['website'], + description=obj['description'], + category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']]) + ) +