From fa030a83fbd1da5a33b772d7b23b8b1516c6890f Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Mon, 7 Aug 2023 09:40:08 +0900 Subject: [PATCH] Add: Verbose users data --- .../app/controllers/api/admin_controller.rb | 6 ++++- frontend/i18n/en.yml | 7 ++++- frontend/i18n/ja.yml | 7 ++++- frontend/pages/admin.tsx | 26 ++++++++++++++++--- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/backend/app/controllers/api/admin_controller.rb b/backend/app/controllers/api/admin_controller.rb index 4522846..7bbab29 100644 --- a/backend/app/controllers/api/admin_controller.rb +++ b/backend/app/controllers/api/admin_controller.rb @@ -11,7 +11,11 @@ def data scheduled: Chart.where(visibility: :scheduled).count, private: Chart.where(visibility: :private).count }, - users: User.count, + users: { + original: User.where(owner_id: nil).count, + alt: User.where.not(owner_id: nil).count, + discord: User.where.not(discord_id: nil).count + }, files: FileResource.all.group_by(&:kind).transform_values(&:count) } diff --git a/frontend/i18n/en.yml b/frontend/i18n/en.yml index 82d1355..3fe8de5 100644 --- a/frontend/i18n/en.yml +++ b/frontend/i18n/en.yml @@ -184,7 +184,12 @@ admin: title: "Admin" stats: title: "Stats" - users: "Users" + users: + title: "Users" + total: "Total" + original: "Original" + alt: "Alt" + discord: "With Discord" charts: title: "Charts" public: "Public" diff --git a/frontend/i18n/ja.yml b/frontend/i18n/ja.yml index 5b0b3e2..5fda93a 100644 --- a/frontend/i18n/ja.yml +++ b/frontend/i18n/ja.yml @@ -144,7 +144,12 @@ admin: title: "管理者ページ" stats: title: "統計" - users: "ユーザー" + users: + title: "ユーザー" + total: "総数" + original: "本名義" + alt: "別名義" + discord: "Discord連携済" charts: title: "譜面" public: "公開" diff --git a/frontend/pages/admin.tsx b/frontend/pages/admin.tsx index 8792f98..d10cf24 100644 --- a/frontend/pages/admin.tsx +++ b/frontend/pages/admin.tsx @@ -35,7 +35,11 @@ const Admin: NextPage = () => { private: number } - users: number + users: { + original: number + alt: number + discord: number + } files: Record } } | null>(null) @@ -55,8 +59,24 @@ const Admin: NextPage = () => {

{t("title")}

-

{t("stats.users")}

-

{data.stats.users}

+

{t("stats.users.title")}

+

+ {data.stats.users.original + data.stats.users.alt} +

+
+
+

{t("stats.users.original")}

+

{data.stats.users.original}

+
+
+

{t("stats.users.alt")}

+

{data.stats.users.alt}

+
+
+

{t("stats.users.discord")}

+

{data.stats.users.discord}

+
+

{t("stats.charts.title")}