mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix for incorrectly handled _facet_size=max, refs #1804
This commit is contained in:
parent
8430c3bc7d
commit
303c6c733d
1 changed files with 13 additions and 6 deletions
|
|
@ -109,12 +109,19 @@ class Facet:
|
||||||
if table_metadata:
|
if table_metadata:
|
||||||
table_facet_size = table_metadata.get("facet_size")
|
table_facet_size = table_metadata.get("facet_size")
|
||||||
custom_facet_size = self.request.args.get("_facet_size")
|
custom_facet_size = self.request.args.get("_facet_size")
|
||||||
if custom_facet_size and custom_facet_size.isdigit():
|
if custom_facet_size:
|
||||||
facet_size = int(custom_facet_size)
|
if custom_facet_size == "max":
|
||||||
elif table_facet_size:
|
facet_size = max_returned_rows
|
||||||
facet_size = table_facet_size
|
elif custom_facet_size.isdigit():
|
||||||
if facet_size == "max":
|
facet_size = int(custom_facet_size)
|
||||||
facet_size = max_returned_rows
|
else:
|
||||||
|
# Invalid value, ignore it
|
||||||
|
custom_facet_size = None
|
||||||
|
if table_facet_size and not custom_facet_size:
|
||||||
|
if table_facet_size == "max":
|
||||||
|
facet_size = max_returned_rows
|
||||||
|
else:
|
||||||
|
facet_size = table_facet_size
|
||||||
return min(facet_size, max_returned_rows)
|
return min(facet_size, max_returned_rows)
|
||||||
|
|
||||||
async def suggest(self):
|
async def suggest(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue