remove deduplication as default

This commit is contained in:
2025-10-17 16:17:07 -03:00
parent 94d00ba203
commit f7babaca9f
15 changed files with 114 additions and 58 deletions

View File

@@ -23,18 +23,25 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
new_image = event.detail['new_image']
metadata = dyn.collection.get_items(
TransactKey(new_image['id'])
+ SortKey('METADATA#SUBSCRIPTION_COVERED', rename_key='subscription')
+ SortKey(
'METADATA#SUBSCRIPTION_COVERED',
rename_key='subscription',
)
+ SortKey(
'METADATA#DEDUPLICATION_WINDOW',
path_spec='offset_days',
rename_key='dedup_window_offset_days',
)
+ SortKey('ORG', rename_key='org'),
+ SortKey(
'ORG',
rename_key='org',
),
flatten_top=False,
)
user = User.model_validate(new_image['user'])
course = Course.model_validate(new_image['course'])
subscription = metadata['subscription'] if 'subscription' in metadata else None
offset_days = metadata.get('dedup_window_offset_days', None)
enrollment = Enrollment(
id=uuid4(),
course=course,
@@ -45,9 +52,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
enrollment,
org=metadata.get('org', None),
subscription=subscription,
deduplication_window={
'offset_days': metadata['dedup_window_offset_days'],
},
deduplication_window={'offset_days': offset_days} if offset_days else None,
linked_entities=frozenset(
{
LinkedEntity(