Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/extend statistics section with users in slack community (#596)
Thomas Kaul6dcd801d0578
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ebbcc8d394..c9157a155f 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.tsindex 073a3dbd9a..2d2ca915e6 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.htmlindex 25d6c2fe7f..e68ec6f919 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<ahref="https://join.slack.com/t/ghostfolio/shared_invite/zt-vsaan64h-F_I0fEo5M0P88lP9ibCxFg"- title="Join the Ghostfolio Slack channel"- >Slack channel</a+ title="Join the Ghostfolio Slack community"+ >Slack community</a>, tweet to<ahref="https://twitter.com/ghostfolio_"@@ -108,12 +108,7 @@<mat-card-content><div class="row"><div class="col-xs-12 col-md-4 my-2">- <h3- class="mb-0"- [hidden]="statistics?.activeUsers1d === undefined"- >- {{ statistics?.activeUsers1d || '-' }}- </h3>+ <h3 class="mb-0">{{ statistics?.activeUsers1d || '-' }}</h3><div class="h6 mb-0"><span i18n>Active Users</span> <small class="text-muted">(Last 24 hours)</small@@ -121,25 +116,15 @@</div></div><div class="col-xs-12 col-md-4 my-2">- <h3- class="mb-0"- [hidden]="statistics?.activeUsers7d === undefined"- >- {{ statistics?.activeUsers7d ?? '-' }}- </h3>+ <h3 class="mb-0">{{ statistics?.newUsers30d ?? '-' }}</h3><div class="h6 mb-0">- <span i18n>Active Users</span> <small class="text-muted"- >(Last 7 days)</small+ <span i18n>New Users</span> <small class="text-muted"+ >(Last 30 days)</small></div></div><div class="col-xs-12 col-md-4 my-2">- <h3- class="mb-0"- [hidden]="statistics?.activeUsers30d === undefined"- >- {{ statistics?.activeUsers30d ?? '-' }}- </h3>+ <h3 class="mb-0">{{ statistics?.activeUsers30d ?? '-' }}</h3><div class="h6 mb-0"><span i18n>Active Users</span> <small class="text-muted">(Last 30 days)</small@@ -147,31 +132,15 @@</div></div><div class="col-xs-12 col-md-4 my-2">- <h3 class="mb-0" [hidden]="statistics?.newUsers30d === undefined">- {{ statistics?.newUsers30d ?? '-' }}- </h3>- <div class="h6 mb-0">- <span i18n>New Users</span> <small class="text-muted"- >(Last 30 days)</small- >- </div>+ <h3 class="mb-0">{{ statistics?.slackCommunityUsers ?? '-' }}</h3>+ <div class="h6 mb-0" i18n>Users in Slack community</div></div><div class="col-xs-12 col-md-4 my-2">- <h3- class="mb-0"- [hidden]="statistics?.gitHubContributors === undefined"- >- {{ statistics?.gitHubContributors ?? '-' }}- </h3>+ <h3 class="mb-0">{{ statistics?.gitHubContributors ?? '-' }}</h3><div class="h6 mb-0" i18n>Contributors on GitHub</div></div><div class="col-xs-12 col-md-4 my-2">- <h3- class="mb-0"- [hidden]="statistics?.gitHubStargazers === undefined"- >- {{ statistics?.gitHubStargazers ?? '-' }}- </h3>+ <h3 class="mb-0">{{ statistics?.gitHubStargazers ?? '-' }}</h3><div class="h6 mb-0" i18n>Stars on GitHub</div></div></div>diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.tsindex ef57ca9dc2..6e19ef1ff8 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.tsindex 98f1753bbb..ba3f0a1d90 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;}