@@ -188,6 +188,10 @@ def process_game_data(game_data):
188
188
# ISO format
189
189
utc_date_str = game_data ["utc_date" ].isoformat () if game_data ["utc_date" ] else None
190
190
191
+ game_time = game_data ["time" ]
192
+ if game_time is None :
193
+ game_time = "TBD"
194
+
191
195
curr_game = GameService .get_game_by_data (
192
196
city ,
193
197
game_data ["date" ],
@@ -196,7 +200,7 @@ def process_game_data(game_data):
196
200
team .id ,
197
201
game_data ["sport" ],
198
202
state ,
199
- game_data [ "time" ] ,
203
+ game_time ,
200
204
)
201
205
if curr_game :
202
206
if curr_game .result != game_data ["result" ]:
@@ -207,7 +211,22 @@ def process_game_data(game_data):
207
211
if utc_date_str :
208
212
GameService .update_game (curr_game .id , {"utc_date" : utc_date_str })
209
213
return
210
-
214
+ # if game time is not TBD, check for existing game with TBD time to update
215
+ if game_time != "TBD" :
216
+ curr_game = GameService .get_game_by_data (
217
+ city ,
218
+ game_data ["date" ],
219
+ game_data ["gender" ],
220
+ location ,
221
+ team .id ,
222
+ game_data ["sport" ],
223
+ state ,
224
+ "TBD" ,
225
+ )
226
+ if curr_game :
227
+ GameService .update_game (curr_game .id , {"time" : game_time })
228
+ GameService .update_game (curr_game .id , {"utc_date" : utc_date_str })
229
+ return
211
230
game_data = {
212
231
"city" : city ,
213
232
"date" : game_data ["date" ],
@@ -217,7 +236,7 @@ def process_game_data(game_data):
217
236
"result" : game_data ["result" ],
218
237
"sport" : game_data ["sport" ],
219
238
"state" : state ,
220
- "time" : game_data [ "time" ] ,
239
+ "time" : game_time ,
221
240
"box_score" : game_data ["box_score" ],
222
241
"score_breakdown" : game_data ["score_breakdown" ],
223
242
"utc_date" : utc_date_str
0 commit comments