Skip to content

Commit

Permalink
fix: fix checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-AntoineA committed Jun 24, 2024
1 parent 91d3f72 commit 559ba92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions app/charts.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
from ._types import SuccessSearchResponse
from ._types import SuccessSearchResponse, ChartsInfos


def build_charts(
search_result: SuccessSearchResponse,
charts_names: list[str] | None,
) -> str:
charts = {}
if charts_names is None:
) -> ChartsInfos:
charts: ChartsInfos = {}
aggregations = search_result.aggregations

if charts_names is None or aggregations is None:
return charts

for chart_name in charts_names:
buckets = search_result.aggregations[chart_name]["buckets"]
agg_data = aggregations.get(chart_name, {})

buckets = agg_data.get('buckets', []) if agg_data else []

# Filter unknown values
values = [
Expand Down
2 changes: 1 addition & 1 deletion app/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def parse_sort_by_script(


def create_aggregation_clauses(
config: IndexConfig, fields: list[str] | None
config: IndexConfig, fields: set[str] | list[str] | None
) -> dict[str, Agg]:
"""Create term bucket aggregation clauses
for all fields corresponding to facets,
Expand Down

0 comments on commit 559ba92

Please sign in to comment.