Skip to content

Commit

Permalink
Merge pull request #1 from Woofles/avery-crudeman-patch-1
Browse files Browse the repository at this point in the history
Scoring play des fix, added completed early status
  • Loading branch information
avery-crudeman committed Apr 23, 2015
2 parents cd7ed8b + a849b1f commit 0d4e91d
Showing 1 changed file with 24 additions and 5 deletions.
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

0 comments on commit 0d4e91d

Please sign in to comment.