cldellow / datasette-ui-extras

Add editing UI and other power-user features to Datasette.
Apache License 2.0
12 stars 1 forks source link

facets: check my understanding of the get_configs function #31

Closed cldellow closed 1 year ago

cldellow commented 1 year ago

Weird, I thought the inner simple varied based on the facet type, I think maybe it doesn't. Figure out if there's a cleaner solution here.

cldellow commented 1 year ago

Looking at https://github.com/simonw/datasette/blob/main/datasette/facets.py, all of ColumnFacet, DateFacet and ArrayFacet use this check:

already_enabled = [c["config"]["simple"] for c in self.get_configs()]

and in facet_results, do:

column = config.get("column") or config["simple"]

So yes, my understanding is wrong here.

cldellow commented 1 year ago

Goal: http://localhost:8001/cooking/posts?_facet_year_month=creation_date&_facet_year=creation_date should show two different facets. Currently it shows the year facet, twice