Browse Source

Merge pull request #151 from dandevaud/feature/Smaller-Improvements

Add colorSIgn & fix calculation
pull/5027/head
dandevaud 4 months ago
committed by GitHub
parent
commit
7ab1a0b4a7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      libs/ui/src/lib/holdings-table/holdings-table.component.html
  2. 7
      libs/ui/src/lib/holdings-table/holdings-table.component.ts

2
libs/ui/src/lib/holdings-table/holdings-table.component.html

@ -184,6 +184,7 @@
<td *matFooterCellDef class="px-1" mat-footer-cell>
<div class="d-flex justify-content-end">
<gf-value
[colorizeSign]="true"
[isCurrency]="true"
[locale]="locale"
[value]="totalChange"
@ -219,6 +220,7 @@
<td *matFooterCellDef class="px-1" mat-footer-cell>
<div class="d-flex justify-content-end">
<gf-value
[colorizeSign]="true"
[isPercent]="true"
[locale]="locale"
[value]="totalChangePercentage"

7
libs/ui/src/lib/holdings-table/holdings-table.component.ts

@ -98,14 +98,15 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
this.totalValue = this.dataSource.data.reduce(
(sum, current) => 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;
this.totalChangePercentage =
this.totalChange / (this.totalValue - this.totalChange);
if (this.holdings) {
this.isLoading = false;

Loading…
Cancel
Save