From ea098b30821015a9f52243e7666251420d31b199 Mon Sep 17 00:00:00 2001 From: Muhammad Anas Date: Mon, 2 Dec 2024 20:13:35 +0000 Subject: [PATCH] feat: add GA in external course sync --- courses/sync_external_courses/emeritus_api.py | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/courses/sync_external_courses/emeritus_api.py b/courses/sync_external_courses/emeritus_api.py index 8d0dee015..8aa5fa4e3 100644 --- a/courses/sync_external_courses/emeritus_api.py +++ b/courses/sync_external_courses/emeritus_api.py @@ -30,13 +30,10 @@ log = logging.getLogger(__name__) -class EmeritusKeyMap(Enum): +class BaseKeyMap(Enum): """ - Emeritus course sync keys. + Base class for external course sync keys with common attributes. """ - - REPORT_NAMES = ["Batch"] - PLATFORM_NAME = "Emeritus" DATE_FORMAT = "%Y-%m-%d" REQUIRED_FIELDS = [ "course_title", @@ -47,11 +44,40 @@ class EmeritusKeyMap(Enum): COURSE_PAGE_SUBHEAD = "Delivered in collaboration with Emeritus." WHO_SHOULD_ENROLL_PAGE_HEADING = "WHO SHOULD ENROLL" LEARNING_OUTCOMES_PAGE_HEADING = "WHAT YOU WILL LEARN" - LEARNING_OUTCOMES_PAGE_SUBHEAD = ( - "MIT xPRO is collaborating with online education provider Emeritus to " - "deliver this online course. By clicking LEARN MORE, you will be taken to " - "a page where you can download the brochure and apply to the program via Emeritus." - ) + + @property + def COURSE_PAGE_SUBHEAD(self): + """ + Generate the course page sub heading dynamically based on the platform name. + """ + return f"Delivered in collaboration with {self.PLATFORM_NAME}." + @property + def LEARNING_OUTCOMES_PAGE_SUBHEAD(self): + """ + Generate the learning outcome page sub heading dynamically based on the platform name. + """ + return ( + f"MIT xPRO is collaborating with online education provider {self.PLATFORM_NAME} to " + "deliver this online course. By clicking LEARN MORE, you will be taken to " + "a page where you can download the brochure and apply to the program via " + f"{self.PLATFORM_NAME}." + ) +class EmeritusKeyMap(BaseKeyMap): + """ + Emeritus course sync keys. + """ + + REPORT_NAMES = ["Batch"] + PLATFORM_NAME = "Emeritus" + + +class GlobalAlumniKeyMap(BaseKeyMap): + """ + Emeritus course sync keys. + """ + + REPORT_NAMES = ["GA - Batch"] + PLATFORM_NAME = "Global Alumni" class EmeritusJobStatus(Enum):