From 6dcd801d057836d06cf96c404c4bf34c2232e159 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:38:55 +0100 Subject: [PATCH] Feature/extend statistics section with users in slack community (#596) * Extend statistics with users in Slack community * Update changelog --- CHANGELOG.md | 4 ++ apps/api/src/app/info/info.service.ts | 13 +++-- .../src/app/pages/about/about-page.html | 53 ++++--------------- libs/common/src/lib/config.ts | 1 + .../lib/interfaces/statistics.interface.ts | 2 +- 5 files changed, 27 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebbcc8d39..c9157a155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the date range component to the holdings tab +### Changed + +- Extended the statistics section on the about page (users in Slack community) + ### Fixed - Fixed the creation of historical data in the admin control panel (upsert instead of update) diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index 073a3dbd9..2d2ca915e 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -7,6 +7,7 @@ import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { PROPERTY_IS_READ_ONLY_MODE, + PROPERTY_SLACK_COMMUNITY_USERS, PROPERTY_STRIPE_CONFIG, PROPERTY_SYSTEM_MESSAGE } from '@ghostfolio/common/config'; @@ -187,6 +188,12 @@ export class InfoService { }); } + private async countSlackCommunityUsers() { + return (await this.propertyService.getByKey( + PROPERTY_SLACK_COMMUNITY_USERS + )) as string; + } + private getDemoAuthToken() { return this.jwtService.sign({ id: InfoService.DEMO_USER_ID @@ -218,19 +225,19 @@ export class InfoService { } catch {} const activeUsers1d = await this.countActiveUsers(1); - const activeUsers7d = await this.countActiveUsers(7); const activeUsers30d = await this.countActiveUsers(30); const newUsers30d = await this.countNewUsers(30); const gitHubContributors = await this.countGitHubContributors(); const gitHubStargazers = await this.countGitHubStargazers(); + const slackCommunityUsers = await this.countSlackCommunityUsers(); statistics = { activeUsers1d, - activeUsers7d, activeUsers30d, gitHubContributors, gitHubStargazers, - newUsers30d + newUsers30d, + slackCommunityUsers }; await this.redisCacheService.set( diff --git a/apps/client/src/app/pages/about/about-page.html b/apps/client/src/app/pages/about/about-page.html index 25d6c2fe7..e68ec6f91 100644 --- a/apps/client/src/app/pages/about/about-page.html +++ b/apps/client/src/app/pages/about/about-page.html @@ -35,8 +35,8 @@ new feature, please join the Ghostfolio Slack channelSlack community, tweet to
-

- {{ statistics?.activeUsers1d || '-' }} -

+

{{ statistics?.activeUsers1d || '-' }}

Active Users (Last 24 hours)
-

- {{ statistics?.activeUsers7d ?? '-' }} -

+

{{ statistics?.newUsers30d ?? '-' }}

- Active Users (Last 7 days)New Users (Last 30 days)
-

- {{ statistics?.activeUsers30d ?? '-' }} -

+

{{ statistics?.activeUsers30d ?? '-' }}

Active Users (Last 30 days)
-

- {{ statistics?.newUsers30d ?? '-' }} -

-
- New Users (Last 30 days) -
+

{{ statistics?.slackCommunityUsers ?? '-' }}

+
Users in Slack community
-

- {{ statistics?.gitHubContributors ?? '-' }} -

+

{{ statistics?.gitHubContributors ?? '-' }}

Contributors on GitHub
-

- {{ statistics?.gitHubStargazers ?? '-' }} -

+

{{ statistics?.gitHubStargazers ?? '-' }}

Stars on GitHub
diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index ef57ca9dc..6e19ef1ff 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -45,6 +45,7 @@ export const PROPERTY_CURRENCIES = 'CURRENCIES'; export const PROPERTY_IS_READ_ONLY_MODE = 'IS_READ_ONLY_MODE'; export const PROPERTY_LAST_DATA_GATHERING = 'LAST_DATA_GATHERING'; export const PROPERTY_LOCKED_DATA_GATHERING = 'LOCKED_DATA_GATHERING'; +export const PROPERTY_SLACK_COMMUNITY_USERS = 'SLACK_COMMUNITY_USERS'; export const PROPERTY_STRIPE_CONFIG = 'STRIPE_CONFIG'; export const PROPERTY_SYSTEM_MESSAGE = 'SYSTEM_MESSAGE'; diff --git a/libs/common/src/lib/interfaces/statistics.interface.ts b/libs/common/src/lib/interfaces/statistics.interface.ts index 98f1753bb..ba3f0a1d9 100644 --- a/libs/common/src/lib/interfaces/statistics.interface.ts +++ b/libs/common/src/lib/interfaces/statistics.interface.ts @@ -1,8 +1,8 @@ export interface Statistics { activeUsers1d: number; - activeUsers7d: number; activeUsers30d: number; gitHubContributors: number; gitHubStargazers: number; newUsers30d: number; + slackCommunityUsers: string; }