1010from app .db import db
1111from app .models import Price , AuthToken
1212from util .oebb import (
13- get_station_id ,
13+ get_station_details ,
1414 get_travel_action_id ,
1515 get_connection_ids ,
1616 get_price_for_connection ,
@@ -82,8 +82,8 @@ def get_price_generator(
8282 current_step += 1
8383 current_message = _ ("Processing origin" )
8484 yield render (current_message , current_step , total_steps )
85- origin_id = get_station_id (origin , access_token = access_token )
86- if not origin_id :
85+ origin_details = get_station_details (origin , access_token = access_token )
86+ if not origin_details or not origin_details . get ( "number" ) :
8787 logger .warning ("Could not process origin." )
8888 current_message = _ ("Failed to process origin" )
8989 yield render (current_message )
@@ -92,8 +92,8 @@ def get_price_generator(
9292 current_step += 1
9393 current_message = _ ("Processing destination" )
9494 yield render (current_message , current_step , total_steps )
95- destination_id = get_station_id (destination , access_token = access_token )
96- if not destination_id :
95+ destination_details = get_station_details (destination , access_token = access_token )
96+ if not destination_details or not destination_details . get ( "number" ) :
9797 logger .warning ("Could not process destination." )
9898 current_message = _ ("Failed to process destination" )
9999 yield render (current_message )
@@ -103,7 +103,10 @@ def get_price_generator(
103103 current_message = _ ("Processing travel action" )
104104 yield render (current_message , current_step , total_steps )
105105 travel_action_id = get_travel_action_id (
106- origin_id , destination_id , date = date , access_token = access_token
106+ origin_details ["number" ],
107+ destination_details ["number" ],
108+ date = date ,
109+ access_token = access_token ,
107110 )
108111 if not travel_action_id :
109112 logger .warning ("Could not process travel action." )
@@ -116,6 +119,8 @@ def get_price_generator(
116119 yield render (current_message , current_step , total_steps )
117120 connection_ids = get_connection_ids (
118121 travel_action_id ,
122+ origin_details ,
123+ destination_details ,
119124 date = date ,
120125 get_only_first = False ,
121126 access_token = access_token ,
0 commit comments