Start a new practice session for a collection
(
session: SessionDep,
current_user: CurrentUser,
practice_session_in: PracticeSessionCreate,
)
| 223 | |
| 224 | @router.post("/practice-sessions", response_model=PracticeSession) |
| 225 | def start_practice_session( |
| 226 | session: SessionDep, |
| 227 | current_user: CurrentUser, |
| 228 | practice_session_in: PracticeSessionCreate, |
| 229 | ) -> Any: |
| 230 | """Start a new practice session for a collection""" |
| 231 | if not services.check_collection_access( |
| 232 | session, practice_session_in.collection_id, current_user.id |
| 233 | ): |
| 234 | raise HTTPException(status_code=404, detail="Collection not found") |
| 235 | |
| 236 | try: |
| 237 | return services.get_or_create_practice_session( |
| 238 | session=session, |
| 239 | collection_id=practice_session_in.collection_id, |
| 240 | user_id=current_user.id, |
| 241 | ) |
| 242 | except EmptyCollectionError as e: |
| 243 | raise HTTPException(status_code=400, detail=str(e)) |
| 244 | |
| 245 | |
| 246 | @router.get("/practice-sessions", response_model=PracticeSessionList) |
nothing calls this directly
no outgoing calls
no test coverage detected