Reintroduce no-limits in get_decks
This commit is contained in:
parent
bf7039aa41
commit
22768b70eb
@ -116,7 +116,7 @@ def games_html(request: Request, db=Depends(get_db)):
|
|||||||
games = list_games(db=db)
|
games = list_games(db=db)
|
||||||
# TODO - a more "data-intensive application" implementation would fetch only the decks involved in the games for
|
# TODO - a more "data-intensive application" implementation would fetch only the decks involved in the games for
|
||||||
# this page
|
# this page
|
||||||
decks = crud.get_decks(db=db)
|
decks = crud.get_decks(db=db, limit=-1)
|
||||||
decks_by_id = {deck.id: deck for deck in decks}
|
decks_by_id = {deck.id: deck for deck in decks}
|
||||||
game_names = {game.id: _build_game_deck_names(game, decks_by_id) for game in games}
|
game_names = {game.id: _build_game_deck_names(game, decks_by_id) for game in games}
|
||||||
return jinja_templates.TemplateResponse(
|
return jinja_templates.TemplateResponse(
|
||||||
|
@ -29,7 +29,10 @@ def get_deck_by_id(db: Session, deck_id: int):
|
|||||||
|
|
||||||
|
|
||||||
def get_decks(db: Session, skip: int = 0, limit: int = 100):
|
def get_decks(db: Session, skip: int = 0, limit: int = 100):
|
||||||
return db.query(models.Deck).offset(skip).limit(limit).all()
|
query = db.query(models.Deck).offset(skip)
|
||||||
|
if limit > -1:
|
||||||
|
query = query.limit(limit)
|
||||||
|
return query.all()
|
||||||
|
|
||||||
|
|
||||||
def create_deck(db: Session, deck: schemas.DeckCreate):
|
def create_deck(db: Session, deck: schemas.DeckCreate):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user