fix(academic): commission subjects and shared careers mapping, role-based scoping and gradebook milestones (v3.8.20)

This commit is contained in:
2026-10-26 18:31:54 -03:00
parent a692c9ce67
commit 9f1ac6d670
23 changed files with 808 additions and 139 deletions
+15
View File
@@ -36,6 +36,9 @@ def list_reservations(
floor: Optional[str] = Query(None),
shift: Optional[str] = Query(None),
search: Optional[str] = Query(None),
teacher_id: Optional[int] = Query(None),
student_id: Optional[int] = Query(None),
mine: Optional[bool] = Query(None),
limit: int = Query(1000, le=5000),
current_user: User = Depends(get_current_user)
):
@@ -44,6 +47,16 @@ def list_reservations(
effective_end = (date_to or end_date or "").strip()
now = datetime.now(timezone.utc).replace(tzinfo=None)
# Scoping de rol o usuario específico
user_role = (getattr(current_user, 'role', '') or '').lower()
effective_teacher_id = teacher_id
effective_student_id = student_id
if mine:
if user_role == 'docente':
effective_teacher_id = int(getattr(current_user, 'id'))
elif user_role == 'alumno':
effective_student_id = int(getattr(current_user, 'id'))
# Resolución inteligente de rangos según scope o filtros
if scope == 'month' and not effective_start and not effective_end:
start_dt = now.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
@@ -84,6 +97,8 @@ def list_reservations(
floor=floor,
shift=shift,
search=search,
teacher_id=effective_teacher_id,
student_id=effective_student_id,
limit=limit
)
result = []