From 7d858f86391a3aba3ce48640496923321551a1b3 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 19 Feb 2025 10:32:58 +0100 Subject: [PATCH 1/4] Added summary row to overview --- .../holdings-table.component.html | 35 +++++++++++++++++++ .../holdings-table.component.ts | 13 +++++++ 2 files changed, 48 insertions(+) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.html b/libs/ui/src/lib/holdings-table/holdings-table.component.html index 5e4526fdc..48a652ebe 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.html +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.html @@ -16,6 +16,7 @@ [tooltip]="element.name" /> + @@ -38,6 +39,7 @@ {{ element.symbol }} + Total @@ -62,6 +64,7 @@ /> + @@ -86,6 +89,14 @@ /> + + + + @@ -107,6 +118,7 @@ /> + @@ -130,6 +142,15 @@ /> + +
+ +
+
@@ -156,6 +177,15 @@ /> + +
+ +
+
@@ -175,6 +205,11 @@ }) " > + diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.ts b/libs/ui/src/lib/holdings-table/holdings-table.component.ts index 14382f420..c40b69a12 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.ts +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.ts @@ -70,6 +70,10 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy { public isLoading = true; public routeQueryParams: Subscription; + protected totalValue = 0; + protected totalChange = 0; + protected totalChangePercentage = 0; + private unsubscribeSubject = new Subject(); public ngOnChanges() { @@ -92,6 +96,15 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy { this.dataSource = new MatTableDataSource(this.holdings); this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; + this.totalValue = this.dataSource.data.reduce( + (sum, current) => sum + current.valueInBaseCurrency, + 0 + ); + this.totalChange = this.dataSource.data.reduce( + (sum, current) => sum + current.netPerformancePercentWithCurrencyEffect, + 0 + ); + this.totalChangePercentage = (this.totalChange / this.totalValue) * 100; if (this.holdings) { this.isLoading = false; From 5b5b662758b3b322c6b3dedae79cc25d763410ee Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 20 Feb 2025 19:56:15 +0100 Subject: [PATCH 2/4] Add colorSIgn & fix calculation --- libs/ui/src/lib/holdings-table/holdings-table.component.html | 2 ++ libs/ui/src/lib/holdings-table/holdings-table.component.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.html b/libs/ui/src/lib/holdings-table/holdings-table.component.html index 48a652ebe..5067555a1 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.html +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.html @@ -145,6 +145,7 @@
sum + current.valueInBaseCurrency, + (sum, current) => (sum += current.valueInBaseCurrency), 0 ); this.totalChange = this.dataSource.data.reduce( - (sum, current) => sum + current.netPerformancePercentWithCurrencyEffect, + (sum, current) => (sum += current.netPerformanceWithCurrencyEffect), 0 ); this.totalChangePercentage = (this.totalChange / this.totalValue) * 100; From 22aadda15d93b10c84acd1c5fc1eca5d2efafecd Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 20 Feb 2025 20:00:53 +0100 Subject: [PATCH 3/4] Another fix in the calculation --- libs/ui/src/lib/holdings-table/holdings-table.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.ts b/libs/ui/src/lib/holdings-table/holdings-table.component.ts index 57040a96b..b02261377 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.ts +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.ts @@ -104,7 +104,8 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy { (sum, current) => (sum += current.netPerformanceWithCurrencyEffect), 0 ); - this.totalChangePercentage = (this.totalChange / this.totalValue) * 100; + this.totalChangePercentage = + this.totalChange / (this.totalValue - this.totalChange); if (this.holdings) { this.isLoading = false; From 18b2b3518b2b8ead2653a44602c817c53413ea26 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 28 Feb 2025 10:29:11 +0100 Subject: [PATCH 4/4] Fix Holding table footer for smaller devices --- .../src/lib/holdings-table/holdings-table.component.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.html b/libs/ui/src/lib/holdings-table/holdings-table.component.html index 5067555a1..f27a23f11 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.html +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.html @@ -64,7 +64,11 @@ />
- + @@ -90,7 +94,7 @@
- +