enrollment to PF
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user