Closed Serneum closed 7 years ago
I have some thoughts on how to do this with Scrivener. Making some notes here:
from(g in Game, distinct: true, select: g.played_at_date, order_by: [desc: :played_at_date])
This potentially requires Scrivener.List
def index(conn, params) do
page = from(g in Game, distinct: true, select: g.played_at_date, order_by: [desc: :played_at_date])
|> CoverMyPingPong.Game.paginate(params)
games =
CoverMyPingPong.Game
|> where(g.played_at_date: page.entries |> List.first)
render conn, :index,
games: games
end
The general idea is that we paginate based on the number of unique dates and look up games based on the current page (the currently selected date)
Ideally this would be paginated by date
Total pages is determined by the number of distinct dates When on a page, look up that date and return all matches When on the first page, show matches from the most recent day that had matches
See comments in #17