Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 31, 2025
1 parent b281ab5 commit d55f3c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions courses/sync_external_courses/external_course_sync_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,15 @@ def create_or_update_product_and_product_version(external_course, course_run):
tuple: (product is created, product version is created)
"""
product, product_created = Product.all_objects.get_or_create(
content_type=ContentType.objects.get_for_model(CourseRun),
object_id=course_run.id,
)
content_type=ContentType.objects.get_for_model(CourseRun),
object_id=course_run.id,
)
if not product_created and not product.is_active:
product.is_active = True
product.save()

current_price = course_run.current_price
if not current_price or current_price != external_course.price:
if not current_price or current_price != external_course.price:
ProductVersion.objects.create(
product=product,
price=external_course.price,
Expand Down Expand Up @@ -851,7 +851,7 @@ def deactivate_removed_course_runs(external_course_run_codes, platform_name):

deactivated_runs_count = course_runs.count()
deactivated_runs_list = course_runs.values_list("external_course_run_id", flat=True)
course_runs.update(live=False)
course_runs.update(live=False)
log.info(
f"Deactivated {deactivated_runs_count} course runs for platform {platform_name}."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def test_fetch_external_courses_error(
(False, None, float(100), float(100), True, True, True),
(True, float(100), float(100), float(100), False, False, True),
(True, float(100), float(111), float(111), False, True, True),
(True, float(100), float(100), float(100), False, False, False)
(True, float(100), float(100), float(100), False, False, False),
],
)
@pytest.mark.django_db
Expand Down Expand Up @@ -802,7 +802,9 @@ def test_create_or_update_product_and_product_version( # noqa: PLR0913
course_run, _, _ = create_or_update_external_course_run(course, external_course)

if create_existing_product:
product = ProductFactory.create(content_object=course_run, is_active=existing_product_is_active)
product = ProductFactory.create(
content_object=course_run, is_active=existing_product_is_active
)

if existing_price:
ProductVersionFactory.create(product=product, price=existing_price)
Expand Down

0 comments on commit d55f3c7

Please sign in to comment.