Skip to content

Commit

Permalink
feat: update populate_exec command to cater to upcoming variant changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AfaqShuaib09 committed Oct 16, 2024
1 parent c8f9c7c commit 72e1eda
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,18 @@ def handle(self, *args, **options): # pylint: disable=too-many-statements
product.update({'variant': variant})
output_dict = self.get_transformed_data(row, product)
output_writer = self.write_csv_row(output_writer, output_dict)
else:
output_dict = self.get_transformed_data(row, product)
output_writer = self.write_csv_row(output_writer, output_dict)
elif 'variant' in product:
variants = []
if product.get('variant'):
variants.append(product.pop('variant'))
if 'custom_presentations' in product and product['custom_presentation']:
variants.extend(product['custom_presentation'])

Check warning on line 168 in course_discovery/apps/course_metadata/management/commands/populate_executive_education_data_csv.py

View check run for this annotation

Codecov / codecov/patch

course_discovery/apps/course_metadata/management/commands/populate_executive_education_data_csv.py#L168

Added line #L168 was not covered by tests
if 'future_variants' in product and product['future_variants']:
variants.extend(product['future_variants'])

Check warning on line 170 in course_discovery/apps/course_metadata/management/commands/populate_executive_education_data_csv.py

View check run for this annotation

Codecov / codecov/patch

course_discovery/apps/course_metadata/management/commands/populate_executive_education_data_csv.py#L170

Added line #L170 was not covered by tests
for variant in variants:
product.update({'variant': variant})
output_dict = self.get_transformed_data(row, product)
output_writer = self.write_csv_row(output_writer, output_dict)
logger.info(self.SUCCESS_MESSAGE.format(product['name'])) # lint-amnesty, pylint: disable=logging-format-interpolation

logger.info("Data Transformation has completed. Warnings raised during the transformation:")
Expand Down

0 comments on commit 72e1eda

Please sign in to comment.