From 51f31d276c23d840e809a173f54d39659475e568 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Thu, 22 Feb 2024 22:21:15 -0500 Subject: [PATCH] site: api: Add score to logs API 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 --- test/site_test.py | 1 + trends/site/common.py | 2 ++ trends/site/templates/api.html | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/test/site_test.py b/test/site_test.py index 322e7e7..c1394e9 100644 --- a/test/site_test.py +++ b/test/site_test.py @@ -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) diff --git a/trends/site/common.py b/trends/site/common.py index 7278951..6f14c41 100644 --- a/trends/site/common.py +++ b/trends/site/common.py @@ -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( @@ -69,6 +70,7 @@ def get_logs(view, dupes): ELSE team1.rgl_teamid END, + 'score', blue_score, 'players', blue_players ) AS blue""" diff --git a/trends/site/templates/api.html b/trends/site/templates/api.html index 16d5c38..c996545 100644 --- a/trends/site/templates/api.html +++ b/trends/site/templates/api.html @@ -442,6 +442,14 @@

Response

The {{ fieldref('teamid') }} of this team, if there is a linked match. +
{{ pre('score') }} : number
+
+ 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. +