Skip to content

Commit ab9ab02

Browse files
authored
fix: override deprecated status from csv (#1149)
1 parent 386d870 commit ab9ab02

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api/src/scripts/populate_db_gtfs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ def populate_db(self, session: "Session", fetch_url: bool = True):
202202
feed = self.query_feed_by_stable_id(session, stable_id, data_type)
203203
if feed:
204204
self.logger.debug(f"Updating {feed.__class__.__name__}: {stable_id}")
205+
# Always set the deprecated status if found in the csv
206+
csv_status = self.get_safe_value(row, "status", "active")
207+
if csv_status.lower() == "deprecated":
208+
feed.status = "deprecated"
205209
else:
206210
feed = self.get_model(data_type)(
207211
id=generate_unique_id(),
@@ -223,7 +227,6 @@ def populate_db(self, session: "Session", fetch_url: bool = True):
223227
source="mdb",
224228
)
225229
]
226-
227230
# If the is_official field from the CSV is empty, the value here will be None and we don't touch the DB
228231
if is_official_from_csv is not None:
229232
if feed.official != is_official_from_csv:

0 commit comments

Comments
 (0)