File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ def process_feed_references(self, session: "Session"):
129129 continue
130130 gtfs_rt_feed = self .query_feed_by_stable_id (session , stable_id , "gtfs_rt" )
131131 static_reference = self .get_safe_value (row , "static_reference" , "" )
132+ gtfs_rt_feed .gtfs_feeds = [] #clear old references
132133 if static_reference :
133134 try :
134135 gtfs_stable_id = f"mdb-{ int (float (static_reference ))} "
@@ -138,12 +139,10 @@ def process_feed_references(self, session: "Session"):
138139 if not gtfs_feed :
139140 self .logger .warning (f"Could not find static reference feed { gtfs_stable_id } for feed { stable_id } " )
140141 continue
141- already_referenced_ids = {ref .id for ref in gtfs_feed .gtfs_rt_feeds }
142- if gtfs_feed and gtfs_rt_feed .id not in already_referenced_ids :
143- gtfs_rt_feed .gtfs_feeds = [gtfs_feed ]
144- print (f"Adding feed reference from { stable_id } to { gtfs_stable_id } " )
145- # Flush to avoid FK violation
146- session .flush ()
142+ gtfs_rt_feed .gtfs_feeds = [gtfs_feed ]
143+ self .logger .info (f"Adding feed reference from { stable_id } to { gtfs_stable_id } " )
144+ # Flush to avoid FK violation
145+ session .flush ()
147146
148147 def process_redirects (self , session : "Session" ):
149148 """
You can’t perform that action at this time.
0 commit comments