enrollment to PF

This commit is contained in:
2025-07-21 18:41:20 -03:00
parent 58a174f432
commit 52e86b9f0f
8 changed files with 488 additions and 25 deletions

View File

@@ -50,6 +50,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
flatten_top=False,
)
# If `class_id` is not found, try to retrieve it from the SQLite
# migration database.
if 'class_id' not in data:
data['class_id'] = _get_class_id(course_id)
@@ -72,6 +74,7 @@ class CourseNotFoundError(Exception):
super().__init__('Course not found')
# Post-migration: remove the following function
def _get_class_id(course_id: str) -> int:
with sqlite3.connect(
database=SQLITE_DATABASE, detect_types=sqlite3.PARSE_DECLTYPES
@@ -84,4 +87,5 @@ def _get_class_id(course_id: str) -> int:
for row in rows:
return int(row['json']['metadata__konviva_id'])
logger.error('Course not found', course_id=course_id)
raise CourseNotFoundError