add user if exists on konviva

This commit is contained in:
2025-07-11 13:55:32 -03:00
parent bd6fbf7166
commit 1b710c81f6
23 changed files with 1633 additions and 68 deletions

View File

@@ -18,7 +18,7 @@ from config import (
)
from middlewares import Tenant, TenantMiddleware
from models import Course, Enrollment, User
from rules.enrollment import DeduplicationWindow, Vacancy, enroll
from rules.enrollment import DeduplicationWindow, Slot, enroll
router = Router()
@@ -32,16 +32,16 @@ processor = BatchProcessor()
class Item(BaseModel):
user: User
course: Course
vacancy: Vacancy | None = None
slot: Slot | None = None
deduplication_window: DeduplicationWindow | None = None
schedule_date: datetime | None = None
@property
def id(self) -> str:
if not self.vacancy:
if not self.slot:
return str(uuid.uuid4())
_, idx = self.vacancy.sk.split('#')
_, idx = self.slot.sk.split('#')
return idx
@@ -81,7 +81,7 @@ def handler(record: Item, context: dict):
'name': tenant.name,
},
deduplication_window=record.deduplication_window,
vacancy=record.vacancy,
slot=record.slot,
persistence_layer=enrollment_layer,
)