List practice cards for a session, optionally filtering and ordering.
(
session: SessionDep,
current_user: CurrentUser,
practice_session_id: uuid.UUID,
status: Literal["pending", "completed", "all"] | None = None,
limit: int = 100,
order: Literal["asc", "desc", "random"] | None = None,
)
| 283 | response_model=PracticeCardListResponse, |
| 284 | ) |
| 285 | def list_practice_cards( |
| 286 | session: SessionDep, |
| 287 | current_user: CurrentUser, |
| 288 | practice_session_id: uuid.UUID, |
| 289 | status: Literal["pending", "completed", "all"] | None = None, |
| 290 | limit: int = 100, |
| 291 | order: Literal["asc", "desc", "random"] | None = None, |
| 292 | ) -> Any: |
| 293 | """List practice cards for a session, optionally filtering and ordering.""" |
| 294 | practice_session = services.get_practice_session( |
| 295 | session=session, |
| 296 | session_id=practice_session_id, |
| 297 | user_id=current_user.id, |
| 298 | ) |
| 299 | if not practice_session: |
| 300 | raise HTTPException(status_code=404, detail="Practice session not found") |
| 301 | |
| 302 | practice_cards, count = services.get_practice_cards( |
| 303 | session=session, |
| 304 | practice_session_id=practice_session_id, |
| 305 | status=status, |
| 306 | limit=limit, |
| 307 | order=order, |
| 308 | ) |
| 309 | |
| 310 | response_data = [ |
| 311 | PracticeCardResponse( |
| 312 | card=pc.card, |
| 313 | is_practiced=pc.is_practiced, |
| 314 | is_correct=pc.is_correct, |
| 315 | ) |
| 316 | for pc in practice_cards |
| 317 | ] |
| 318 | |
| 319 | return PracticeCardListResponse(data=response_data, count=count) |
| 320 | |
| 321 | |
| 322 | @router.patch( |
nothing calls this directly
no test coverage detected