bugfix für statistiken
This commit is contained in:
parent
f18ced6570
commit
9cfe5e50c4
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
@ -26,22 +26,40 @@ def team_statistics(request, team_id):
|
||||
for game in games:
|
||||
result = game.result
|
||||
print("DEBUGGER:"+str(result))
|
||||
print("INNING_RESULTS:"+str(result.inning_results))
|
||||
|
||||
home_innings = [inning for inning in result.inning_results.get('home', []) if isinstance(inning, int)]
|
||||
away_innings = [inning for inning in result.inning_results.get('away', []) if isinstance(inning, int)]
|
||||
sorted_items = sorted(result.inning_results.items(),key=lambda x: int(x[0].split('_')[1]))
|
||||
home_innings = [
|
||||
item[1].get('home')
|
||||
for item in sorted_items
|
||||
if isinstance(item[1].get('home'), int)
|
||||
]
|
||||
sorted_items = sorted(result.inning_results.items(),key=lambda x: int(x[0].split('_')[1]))
|
||||
away_innings = [
|
||||
item[1].get('guest')
|
||||
for item in sorted_items
|
||||
if isinstance(item[1].get('guest'), int)
|
||||
]
|
||||
home_score = sum(home_innings)
|
||||
away_score = sum(away_innings)
|
||||
print("HOMEINNING:"+str(home_innings))
|
||||
if game.is_home_game:
|
||||
print("HEIMSPIEL")
|
||||
team_score = home_score
|
||||
opponent_score = away_score
|
||||
print("Teamscore"+str(team_score))
|
||||
print("Gegnerscore"+str(opponent_score))
|
||||
else:
|
||||
print("Auswerts")
|
||||
team_score = away_score
|
||||
opponent_score = home_score
|
||||
print("Teamscore"+str(team_score))
|
||||
print("Gegnerscore"+str(opponent_score))
|
||||
|
||||
runs_scored += team_score
|
||||
runs_allowed += opponent_score
|
||||
|
||||
|
||||
# W-L Record and Streak
|
||||
if team_score > opponent_score:
|
||||
wins += 1
|
||||
@ -57,6 +75,8 @@ def team_statistics(request, team_id):
|
||||
else:
|
||||
streak_counter = 1
|
||||
last_game_result = 'loss'
|
||||
print("Win:"+str(wins))
|
||||
print("Looses:"+str(losses))
|
||||
# Inning Heatmap
|
||||
team_innings = home_innings if game.is_home_game else away_innings
|
||||
for i, runs in enumerate(team_innings):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user