Skip to content

Commit

Permalink
Fixes minor home score issue and bad data for Final shotmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdonders committed Sep 28, 2019
1 parent 8c9f331 commit 737a717
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lambda_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,14 @@ def trigger_lambda(game_id, lambda_arn, home_score, away_score):
# Check game status
game_state = livefeed["gameData"]["status"]["abstractGameState"]

# Get required attributes for lambda trigger
linescore = livefeed["liveData"]["linescore"]
home_score = linescore["teams"]["home"]["goals"]
away_score = linescore["teams"]["away"]["goals"]

if game_state == "Final":
logging.info("Game is now final - send one final (end of game) shotmap & exit.")
lambda_response = trigger_lambda(game_id=game_id, lambda_arn=LAMBDA_ARN)
lambda_response = trigger_lambda(game_id=game_id, lambda_arn=LAMBDA_ARN, home_score=home_score, away_score=away_score)
logging.info(lambda_response)
sys.exit()

Expand All @@ -94,11 +99,6 @@ def trigger_lambda(game_id, lambda_arn, home_score, away_score):
time.sleep(SLEEP_TIME)
continue

# Get required attributes for lambda trigger
linescore = livefeed["liveData"]["linescore"]
home_score = linescore["teams"]["home"]["goals"]
away_score = linescore["teams"]["away"]["goals"]

period = livefeed["liveData"]["linescore"]["currentPeriod"]
period_ordinal = livefeed["liveData"]["linescore"]["currentPeriodOrdinal"]
period_remain = livefeed["liveData"]["linescore"]["currentPeriodTimeRemaining"]
Expand Down
2 changes: 1 addition & 1 deletion shotmaps_generator_sendtweet/lambda_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def lambda_handler(event, context):
if home_score == away_score:
tweet_text = (
f"At the end of the {period_ordinal} period, the {home_team_short} & "
f"{away_team_short} are tied at 1."
f"{away_team_short} are tied at {home_score}."
f"\n\n{game_hashtag}"
)

Expand Down

0 comments on commit 737a717

Please sign in to comment.