Skip to content

Commit

Permalink
refactor: update condition so command will not break in case of no va…
Browse files Browse the repository at this point in the history
…riants
  • Loading branch information
AfaqShuaib09 committed Sep 26, 2024
1 parent c678b64 commit 0780007
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ def handle(self, *args, **options): # pylint: disable=too-many-statements
if getsmarter_flag:
product['organization'] = map_external_org_code_to_internal_org_code(
product['universityAbbreviation'], product_source)
if product.get('variants'):
if 'variants' in product:
variants = product.pop('variants')
if not variants:
logger.warning(f"Skipping product {product['name']} ingestion as it has no variants")
for variant in variants:
product.update({'variant': variant})
output_dict = self.get_transformed_data(row, product)
Expand Down

0 comments on commit 0780007

Please sign in to comment.