From d29102dae8c920eccd2a6bea1369926980823075 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Mon, 21 Mar 2022 19:46:11 -0400 Subject: [PATCH] Add meta and count field to teams endpoints to make it easier to show graphs (#2072) * Add meta and count field to teams endpoints to make it easier to show graphs --- CTFd/api/v1/teams.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CTFd/api/v1/teams.py b/CTFd/api/v1/teams.py index e343611f..83f229fd 100644 --- a/CTFd/api/v1/teams.py +++ b/CTFd/api/v1/teams.py @@ -498,7 +498,8 @@ class TeamPrivateSolves(Resource): if response.errors: return {"success": False, "errors": response.errors}, 400 - return {"success": True, "data": response.data} + count = len(response.data) + return {"success": True, "data": response.data, "meta": {"count": count}} @teams_namespace.route("/me/fails") @@ -562,7 +563,8 @@ class TeamPublicSolves(Resource): if response.errors: return {"success": False, "errors": response.errors}, 400 - return {"success": True, "data": response.data} + count = len(response.data) + return {"success": True, "data": response.data, "meta": {"count": count}} @teams_namespace.route("//fails")