Skip to content

Commit

Permalink
site: api: Add score to logs API
Browse files Browse the repository at this point in the history
Add score to the logs api. This is effectively free, and makes it possible
to e.g. do statistics based on who won.

Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed Feb 23, 2024
1 parent a2717f4 commit 51f31d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/site_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def paged(**args):
else:
assert team['rgl_teamid'] is None

assert team['score'] is not None
for player in team['players']:
SteamID(player)

Expand Down
2 changes: 2 additions & 0 deletions trends/site/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def get_logs(view, dupes):
ELSE
team2.rgl_teamid
END,
'score', red_score,
'players', red_players
) AS red,
json_build_object(
Expand All @@ -69,6 +70,7 @@ def get_logs(view, dupes):
ELSE
team1.rgl_teamid
END,
'score', blue_score,
'players', blue_players
) AS blue"""

Expand Down
8 changes: 8 additions & 0 deletions trends/site/templates/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,14 @@ <h4>Response</h4>
The {{ fieldref('teamid') }} of this team, if there is a linked
match.
</dd>
<dt>{{ pre('score') }} : number</dt>
<dd>
The points scored by this team. This is the raw number as reported
on the scoreboard, and does not reflect rounds played. For instance,
if there is a stalemate due to the round timer this will not be
reflected in either score, and if there is a stalemate due to the
time limit this will be an extra point for the winning team.
</dd>
</dl>
</p>
</dd>
Expand Down

0 comments on commit 51f31d2

Please sign in to comment.