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] gameServers: [GameServer]
userCount: Int userCount: Int
activeUserCount: Int
users(filter: UserFilter, page: Page, sort: Sort): [User] users(filter: UserFilter, page: Page, sort: Sort): [User]
achievementCount: Int achievementCount: Int

View File

@ -76,6 +76,10 @@ class ServerQuery(DataQueryWithHistoryABC):
lambda server, *_: self._levels.get_levels_by_server_id(server.id), lambda server, *_: self._levels.get_levels_by_server_id(server.id),
LevelFilter, 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( self.add_collection(
"user", "user",
lambda server, *_: self._users.get_users_by_server_id(server.id), lambda server, *_: self._users.get_users_by_server_id(server.id),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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