From 0311c40246c07fed79e90a9325d7a1906b3d6f87 Mon Sep 17 00:00:00 2001 From: Vinicius Date: Wed, 17 Apr 2024 12:25:15 -0300 Subject: [PATCH] fix: avoid zipping none --- bd_api/apps/api/v1/search_views.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bd_api/apps/api/v1/search_views.py b/bd_api/apps/api/v1/search_views.py index ccaf7883..3f9b2553 100644 --- a/bd_api/apps/api/v1/search_views.py +++ b/bd_api/apps/api/v1/search_views.py @@ -125,7 +125,7 @@ def key(r): def as_search_result(result: SearchResult): tag = [] - for slug, name in zip(result.tag_slug, result.tag_name): + for slug, name in zip(result.tag_slug or [], result.tag_name or []): tag.append( { "slug": slug, @@ -134,7 +134,7 @@ def as_search_result(result: SearchResult): ) theme = [] - for slug, name in zip(result.theme_slug, result.theme_name): + for slug, name in zip(result.theme_slug or [], result.theme_name or []): theme.append( { "slug": slug, @@ -143,7 +143,7 @@ def as_search_result(result: SearchResult): ) entity = [] - for slug, name in zip(result.entity_slug, result.entity_name): + for slug, name in zip(result.entity_slug or [], result.entity_name or []): entity.append( { "slug": slug, @@ -153,12 +153,12 @@ def as_search_result(result: SearchResult): organization = [] for pk, slug, name, picture, website, description in zip( - result.organization_id, - result.organization_slug, - result.organization_name, - result.organization_picture, - result.organization_website, - result.organization_description, + result.organization_id or [], + result.organization_slug or [], + result.organization_name or [], + result.organization_picture or [], + result.organization_website or [], + result.organization_description or [], ): organization.append( {