From a4d5eaa0e1f19edbbb627c7806e80720f4df6dd5 Mon Sep 17 00:00:00 2001 From: NoamGaash Date: Mon, 1 May 2023 21:38:25 +0300 Subject: [PATCH] feat: add clustername to ALLOWED_GROUP_BY_FIELDS --- open_bus_stride_api/routers/gtfs_rides_agg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/open_bus_stride_api/routers/gtfs_rides_agg.py b/open_bus_stride_api/routers/gtfs_rides_agg.py index 07facc2..ed5c3c4 100644 --- a/open_bus_stride_api/routers/gtfs_rides_agg.py +++ b/open_bus_stride_api/routers/gtfs_rides_agg.py @@ -36,7 +36,7 @@ class GtfsRidesAggGroupByPydanticModel(pydantic.BaseModel): PYDANTIC_MODEL = GtfsRidesAggPydanticModel GROUP_BY_PYDANTIC_MODEL = GtfsRidesAggGroupByPydanticModel DEFAULT_LIMIT = 1000 -ALLOWED_GROUP_BY_FIELDS = ['gtfs_route_date', 'operator_ref', 'day_of_week'] +ALLOWED_GROUP_BY_FIELDS = ['gtfs_route_date', 'operator_ref', 'day_of_week', 'clustername'] @common.router_list(router, TAG, PYDANTIC_MODEL, WHAT_PLURAL) @@ -89,7 +89,7 @@ def group_by_(date_from: datetime.date = common.doc_param('date', filter_type='d count(1) as total_routes, sum(agg.num_planned_rides) as total_planned_rides, sum(agg.num_actual_rides) as total_actual_rides - from gtfs_rides_agg agg, gtfs_route rt + from gtfs_rides_agg agg, gtfs_route rt join clustertoline c on rt.line_ref = c.officelineid where agg.gtfs_route_id = rt.id and agg.gtfs_route_date >= :date_from