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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
3 deletions
-
libs/ui/src/lib/holdings-table/holdings-table.component.html
-
libs/ui/src/lib/holdings-table/holdings-table.component.ts
|
@ -184,6 +184,7 @@ |
|
|
<td *matFooterCellDef class="px-1" mat-footer-cell> |
|
|
<td *matFooterCellDef class="px-1" mat-footer-cell> |
|
|
<div class="d-flex justify-content-end"> |
|
|
<div class="d-flex justify-content-end"> |
|
|
<gf-value |
|
|
<gf-value |
|
|
|
|
|
[colorizeSign]="true" |
|
|
[isCurrency]="true" |
|
|
[isCurrency]="true" |
|
|
[locale]="locale" |
|
|
[locale]="locale" |
|
|
[value]="totalChange" |
|
|
[value]="totalChange" |
|
@ -219,6 +220,7 @@ |
|
|
<td *matFooterCellDef class="px-1" mat-footer-cell> |
|
|
<td *matFooterCellDef class="px-1" mat-footer-cell> |
|
|
<div class="d-flex justify-content-end"> |
|
|
<div class="d-flex justify-content-end"> |
|
|
<gf-value |
|
|
<gf-value |
|
|
|
|
|
[colorizeSign]="true" |
|
|
[isPercent]="true" |
|
|
[isPercent]="true" |
|
|
[locale]="locale" |
|
|
[locale]="locale" |
|
|
[value]="totalChangePercentage" |
|
|
[value]="totalChangePercentage" |
|
|
|
@ -98,14 +98,15 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy { |
|
|
this.dataSource.paginator = this.paginator; |
|
|
this.dataSource.paginator = this.paginator; |
|
|
this.dataSource.sort = this.sort; |
|
|
this.dataSource.sort = this.sort; |
|
|
this.totalValue = this.dataSource.data.reduce( |
|
|
this.totalValue = this.dataSource.data.reduce( |
|
|
(sum, current) => sum + current.valueInBaseCurrency, |
|
|
(sum, current) => (sum += current.valueInBaseCurrency), |
|
|
0 |
|
|
0 |
|
|
); |
|
|
); |
|
|
this.totalChange = this.dataSource.data.reduce( |
|
|
this.totalChange = this.dataSource.data.reduce( |
|
|
(sum, current) => sum + current.netPerformancePercentWithCurrencyEffect, |
|
|
(sum, current) => (sum += current.netPerformanceWithCurrencyEffect), |
|
|
0 |
|
|
0 |
|
|
); |
|
|
); |
|
|
this.totalChangePercentage = (this.totalChange / this.totalValue) * 100; |
|
|
this.totalChangePercentage = |
|
|
|
|
|
this.totalChange / (this.totalValue - this.totalChange); |
|
|
|
|
|
|
|
|
if (this.holdings) { |
|
|
if (this.holdings) { |
|
|
this.isLoading = false; |
|
|
this.isLoading = false; |
|
|