Permalink
Browse files

Compute average goals instead of total goals

  • Loading branch information...
1 parent 1c5a909 commit d7b8f892601a7f5b2b1a6a9f582b29c1ca306418 @fangeugene fangeugene committed Mar 6, 2016
Showing with 10 additions and 14 deletions.
  1. +2 −2 helpers/event_insights_helper.py
  2. +8 −12 templates_jinja2/event_partials/event_insights.html
@@ -105,8 +105,8 @@ def calculate_event_insights_2016(cls, matches):
'C_Drawbridge': [0, 0, 0],
'D_RoughTerrain': [0, 0, 0],
'D_RockWall': [0, 0, 0],
- 'high_goals': high_goals,
- 'low_goals': low_goals,
+ 'average_high_goals': float(high_goals) / finished_matches,
+ 'average_low_goals': float(low_goals) / finished_matches,
'breaches': [breaches, opportunities_1x, 100.0 * float(breaches) / opportunities_1x], # [# success, # opportunities, %]
'scales': [scales, opportunities_3x, 100.0 * float(scales) / opportunities_3x],
'challenges': [challenges, opportunities_3x, 100.0 * float(challenges) / opportunities_3x],
@@ -95,18 +95,6 @@
</thead>
<tbody>
<tr>
- <td>Low Goals</td>
- <td>{{event_insights.low_goals}}</td>
- <td>--</td>
- <td>--</td>
- </tr>
- <tr>
- <td>High Goals</td>
- <td>{{event_insights.high_goals}}</td>
- <td>--</td>
- <td>--</td>
- </tr>
- <tr>
<td>Challenges</td>
<td>{{event_insights.challenges[0]}}</td>
<td>{{event_insights.challenges[1]}}</td>
@@ -139,6 +127,14 @@
</thead>
<tbody>
<tr>
+ <td>Average Low Goals</td>
+ <td>{{'%0.2f' | format(event_insights.average_low_goals|float)}}</td>
+ </tr>
+ <tr>
+ <td>Average High Goals</td>
+ <td>{{'%0.2f' | format(event_insights.average_high_goals|float)}}</td>
+ </tr>
+ <tr>
<td>High Score</td>
<td>{{event_insights.high_score[0]}} in <a href="/match/{{event_insights.high_score[1]}}">{{event_insights.high_score[2]}}</a></td>
</tr>

0 comments on commit d7b8f89

Please sign in to comment.