Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoring play des fix, added completed early status #1

Merged
merged 1 commit into from
Apr 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,10 @@ def generatescoringplays(self,files):
try:
if s.find('atbat').get('score') == "T":
scoringplays = scoringplays + s.find('atbat').get('des')

elif actions[len(actions) - 1].get("score") == "T":
scoringplays = scoringplays + actions[len(actions) - 1].get("des")

elif s.find('action').get("score") == "T":
scoringplays = scoringplays + s.find('action').get('des')
else:
scoringplays = scoringplays + s.get("pbp")
scoringplays = scoringplays + s.get('pbp')
except:
scoringplays = scoringplays + "Scoring play description currently unavailable."

Expand Down Expand Up @@ -442,6 +440,27 @@ def generatestatus(self,files):
print "Returning status..."
return status
break
elif game.get('status') == "Completed Early":
status = status + "##COMPLETED EARLY: "
if int(s.get("home_team_runs")) < int(s.get("away_team_runs")):
status = status + s.get("away_team_runs") + "-" + s.get("home_team_runs") + " " + s.get(
"away_team_name") + "\n"
status = status + self.generatedecisions(files)
print "Returning status..."
return status
break
elif int(s.get("home_team_runs")) > int(s.get("away_team_runs")):
status = status + s.get("home_team_runs") + "-" + s.get("away_team_runs") + " " + s.get(
"home_team_name") + "\n"
status = status + self.generatedecisions(files)
print "Returning status..."
return status
break
elif int(s.get("home_team_runs")) == int(s.get("away_team_runs")):
status = status + "TIE"
print "Returning status..."
return status
break
elif game.get('status') == "Postponed":
status = status + "##POSTPONED\n\n"
print "Returning status..."
Expand Down