Added active member count #413
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 6m38s

This commit is contained in:
Sven Heidemann 2023-11-05 00:18:01 +01:00
parent 665e524aa9
commit 8e55ebc4b7
8 changed files with 12 additions and 2 deletions

View File

@ -26,6 +26,7 @@ type Server implements TableWithHistoryQuery {
gameServers: [GameServer]
userCount: Int
activeUserCount: Int
users(filter: UserFilter, page: Page, sort: Sort): [User]
achievementCount: Int

View File

@ -76,6 +76,10 @@ class ServerQuery(DataQueryWithHistoryABC):
lambda server, *_: self._levels.get_levels_by_server_id(server.id),
LevelFilter,
)
self.set_field(
"activeUserCount",
lambda server, *_: self._users.get_users_by_server_id(server.id).where(lambda x: not x.left_server).count(),
)
self.add_collection(
"user",
lambda server, *_: self._users.get_users_by_server_id(server.id),

View File

@ -23,6 +23,7 @@ export interface Server extends Data {
levelCount?: number;
levels?: Level[];
userCount?: number;
activeUserCount?: number;
users?: User[];
config?: ServerConfig;
hasFeatureFlag?: FeatureFlag;

View File

@ -68,6 +68,7 @@ export class Queries {
name
iconURL
userCount
activeUserCount
clients {
id
discordId

View File

@ -40,6 +40,7 @@
<i class="pi pi-users"></i>
{{server.userCount}}
{{'view.dashboard.server.member_count' | translate}}
{{'view.dashboard.server.active_members' | translate}} {{server ? server.activeUserCount : ''}}
</div>
</div>

View File

@ -23,9 +23,9 @@
</h3>
<div class="data">
<i class="pi pi-users"></i>
{{server ? server.userCount : ''}}
<i class="pi pi-users"></i> {{server ? server.userCount : ''}}
{{'view.dashboard.server.member_count' | translate}}
{{'view.dashboard.server.active_members' | translate}} {{server ? server.activeUserCount : ''}}
</div>
<div class="client-data"

View File

@ -360,6 +360,7 @@
},
"header": "Dashboard",
"server": {
"active_members": "davon aktiv:",
"header": "Server",
"member_count": "Mitglied(er)"
},

View File

@ -360,6 +360,7 @@
},
"header": "Dashboard",
"server": {
"active_members": "active:",
"header": "Server",
"member_count": "Member(s)"
},