forked from RealistikOsu/USSR
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Aggregate score stats API * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cleanup import * prevent exc * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refmt * send to prod * Expose under /public APIs * remove prod takeover --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: James Wilson <[email protected]>
- Loading branch information
1 parent
2106ef8
commit 0bc59e8
Showing
5 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import annotations | ||
|
||
import app.usecases | ||
|
||
|
||
async def total_scores_set() -> int: | ||
return await app.usecases.aggregate_score_stats.total_scores_set() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
import app.state.services | ||
|
||
|
||
async def total_scores_set() -> int: | ||
return sum( | ||
[ | ||
( | ||
await app.state.services.database.fetch_val( | ||
f"""\ | ||
SELECT count(*) | ||
FROM {table} | ||
""", | ||
) | ||
or 0 | ||
) | ||
for table in ("scores", "scores_relax", "scores_ap") | ||
], | ||
) |