our database setup involves tables with one-to-many and many-to-many relationships. we need to correctly count the total number of distinct entries that match the query criteria across these related tables. our current implementation relies on the per_page limit and offset query params to filter out the data. however, the way these two parameters are used seem to be incompatible with the assumptions made in handle_pagination() helper function.
the problem becomes evident when working with /clips endpoint which requires joining clip, clipproject and project tables. the pagination is not accurately reflecting the total count of distinct entries, leading to discrepancies in the total pages and entries reported versus the actual data fetched.
fixing this issue turned to be more involved than i anticipated. and i decided to put it on the back burner while temporary hard coding the per_page to a large number (300). i'll address this at a later time.
our database setup involves tables with
one-to-many
andmany-to-many
relationships. we need to correctly count the total number of distinct entries that match the query criteria across these related tables. our current implementation relies on theper_page
limit andoffset
query params to filter out the data. however, the way these two parameters are used seem to be incompatible with the assumptions made inhandle_pagination()
helper function.the problem becomes evident when working with
/clips
endpoint which requires joiningclip
,clipproject
andproject
tables. the pagination is not accurately reflecting the total count of distinct entries, leading to discrepancies in the total pages and entries reported versus the actual data fetched.