vantage-ola / tracknow

Share your racing moments.
https://tracknow.vercel.app/
MIT License
4 stars 3 forks source link

add infinite scrolling for backend api #50

Closed vantage-ola closed 3 months ago

vantage-ola commented 3 months ago
Dozie2001 commented 3 months ago

Hey @vantage-ola congrats on launching official version. How urgent is this issue? Interested on getting assigned.

vantage-ola commented 3 months ago

@Dozie2001 just seeing this walai, sorry about that. i havent launched the official version yet... still pre releases.... i will launch pre release alpha 2.0 tomorrow, from there, i can assign tasks, thanks bro 😩❤️

vantage-ola commented 3 months ago
  • implement infinite scrolling for /api/v1/laptimes (i dont want to load all the laptimes at once) not efficient ❌

fiexd this in #78 /tracknow/backend/routes.py


page = request.args.get('page', 1, type=int)
    items_per_page = 5

    # Get the lap times ordered by date_created in descending order (most recent first)
    laptimes_query = Laptime.query.order_by(desc(Laptime.date_created))

    # Pagination: skip the items of previous pages and limit to items_per_page
    laptimes = laptimes_query.offset((page - 1) * items_per_page).limit(items_per_page).all()