Skip to content

Commit cc48089

Browse files
bug: fix bug making operations feeds endpoint fail when called without data_type filtering (#1157)
1 parent fabc85c commit cc48089

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

functions-python/helpers/query_helper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
from datetime import datetime
33
from typing import Type
44

5+
from sqlalchemy import and_
6+
from sqlalchemy.orm import Session, joinedload
7+
from sqlalchemy.orm.query import Query
8+
59
from shared.database_gen.sqlacodegen_models import (
610
Feed,
711
Gtfsrealtimefeed,
@@ -10,9 +14,6 @@
1014
Gtfsdataset,
1115
Validationreport,
1216
)
13-
from sqlalchemy import and_
14-
from sqlalchemy.orm import Session, joinedload
15-
from sqlalchemy.orm.query import Query
1617

1718
feed_mapping = {"gtfs_rt": Gtfsrealtimefeed, "gtfs": Gtfsfeed, "gbfs": Gbfsfeed}
1819

@@ -109,6 +110,10 @@ def get_feeds_query(
109110

110111
conditions = []
111112

113+
if data_type is None:
114+
conditions.append(model.data_type.in_(["gtfs", "gtfs_rt"]))
115+
logging.info("Added filter to exclude gbfs feeds")
116+
112117
if operation_status:
113118
conditions.append(model.operational_status == operation_status)
114119
logging.info("Added operational_status filter: %s", operation_status)

0 commit comments

Comments
 (0)