From 6d0c6aa47f8cd6d08a849db68c076b2b78b4d5bc Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 24 Oct 2024 14:36:24 +0100 Subject: [PATCH] add more statistics --- projects/backend/src/service/app.service.ts | 9 +++++++++ .../common/src/types/backend/app-statistics.ts | 15 +++++++++++++++ projects/website/src/app/(pages)/page.tsx | 3 +++ 3 files changed, 27 insertions(+) diff --git a/projects/backend/src/service/app.service.ts b/projects/backend/src/service/app.service.ts index 60c692d..1790f9f 100644 --- a/projects/backend/src/service/app.service.ts +++ b/projects/backend/src/service/app.service.ts @@ -1,5 +1,8 @@ import { PlayerModel } from "@ssr/common/model/player"; import { AppStatistics } from "@ssr/common/types/backend/app-statistics"; +import { ScoreSaberScoreModel } from "@ssr/common/model/score/impl/scoresaber-score"; +import { AdditionalScoreDataModel } from "@ssr/common/model/additional-score-data/additional-score-data"; +import { BeatSaverMapModel } from "@ssr/common/model/beatsaver/map"; export class AppService { /** @@ -7,9 +10,15 @@ export class AppService { */ public static async getAppStatistics(): Promise { const trackedPlayers = await PlayerModel.countDocuments(); + const trackedScores = await ScoreSaberScoreModel.countDocuments(); + const additionalScoresData = await AdditionalScoreDataModel.countDocuments(); + const cachedBeatSaverMaps = await BeatSaverMapModel.countDocuments(); return { trackedPlayers, + trackedScores, + additionalScoresData, + cachedBeatSaverMaps, }; } } diff --git a/projects/common/src/types/backend/app-statistics.ts b/projects/common/src/types/backend/app-statistics.ts index d41543b..69ffafc 100644 --- a/projects/common/src/types/backend/app-statistics.ts +++ b/projects/common/src/types/backend/app-statistics.ts @@ -3,4 +3,19 @@ export type AppStatistics = { * The total amount of players being tracked. */ trackedPlayers: number; + + /** + * The total amount of ScoreSaber scores tracked. + */ + trackedScores: number; + + /** + * The total amount of additional data for scores being tracked. + */ + additionalScoresData: number; + + /** + * The amount of cached BeatSaver maps. + */ + cachedBeatSaverMaps: number; }; diff --git a/projects/website/src/app/(pages)/page.tsx b/projects/website/src/app/(pages)/page.tsx index 23d7597..d4da7a8 100644 --- a/projects/website/src/app/(pages)/page.tsx +++ b/projects/website/src/app/(pages)/page.tsx @@ -25,6 +25,9 @@ export default async function HomePage() {

Site Statistics

+ + +
)}