Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add clustername to ALLOWED_GROUP_BY_FIELDS #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions open_bus_stride_api/routers/gtfs_rides_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down