Skip to content

Commit

Permalink
fix: external sync when there is no platform with passed name (#3385)
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanashraf7 authored Jan 28, 2025
1 parent b91d0a5 commit 645b5b4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions courses/management/commands/sync_external_course_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ def handle(self, *args, **options): # noqa: ARG002
"""Handle command execution"""
vendor_name = options["vendor_name"]
keymap = EXTERNAL_COURSE_VENDOR_KEYMAPS.get(vendor_name.lower())
if not keymap:
platform = Platform.objects.filter(name__iexact=vendor_name).first()

if not platform:
self.stdout.write(self.style.ERROR(f"Unknown vendor name {vendor_name}."))
return

platform = Platform.objects.filter(name__iexact=vendor_name).first()
if platform and not platform.enable_sync and not options.get("force"):
if not keymap:
self.stdout.write(
self.style.ERROR(f"Mapping does not exist for {vendor_name}.")
)
return

if not platform.enable_sync and not options.get("force"):
self.stdout.write(
self.style.ERROR(
f"Course sync is off for {vendor_name}. Please enable it before syncing."
Expand Down

0 comments on commit 645b5b4

Please sign in to comment.