fix(api): next=null sur dernière page en mode agrégation (#78)
Si la page retournée est partielle (len < page_size), on sait qu'on est sur la dernière page → next=null, parité data.gouv.fr. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -202,10 +202,14 @@ def data():
|
||||
offset=(page - 1) * page_size,
|
||||
)
|
||||
df_ready = df.with_columns(cs.temporal().cast(pl.String))
|
||||
# Si la page est partielle, on connaît le total exact ; sinon on ne sait pas.
|
||||
agg_total = (
|
||||
(page - 1) * page_size + df.height if df.height < page_size else None
|
||||
)
|
||||
return {
|
||||
"data": df_ready.to_dicts(),
|
||||
"meta": {"page": page, "page_size": page_size},
|
||||
"links": _build_links(page, page_size, None),
|
||||
"links": _build_links(page, page_size, agg_total),
|
||||
}
|
||||
|
||||
df = query_marches(
|
||||
|
||||
Reference in New Issue
Block a user