Skip to content

Commit 72d14ff

Browse files
Merge pull request #31 from cuappdev/skye/reverse-fix-3
Switch scoreBreakdown scores consistently
2 parents fbf8c7b + 61da36f commit 72d14ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/scrapers/games_scraper.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ def process_game_data(game_data):
213213
if game_time is None:
214214
game_time = "TBD"
215215

216+
is_home_game = "Ithaca" in city
217+
218+
# make sure cornell is first in score breakdown - switch order on home games
219+
# do this before branching
220+
if game_data["score_breakdown"] and is_home_game:
221+
game_data["score_breakdown"] = game_data["score_breakdown"][::-1]
222+
216223
# finds any existing game with the same key fields regardless of time
217224
curr_game = GameService.get_game_by_key_fields(
218225
city,
@@ -253,10 +260,5 @@ def process_game_data(game_data):
253260
"score_breakdown": game_data["score_breakdown"],
254261
"utc_date": utc_date_str
255262
}
256-
257-
# make sure cornell is first in score breakdown - switch order on home games
258-
if game_data["score_breakdown"]:
259-
if city == "Ithaca":
260-
game_data["score_breakdown"] = game_data["score_breakdown"][::-1]
261263

262264
GameService.create_game(game_data)

0 commit comments

Comments
 (0)