Bugfix/fix cash position rows in holdings table (#2237)

* Fix cash position rows

* Update changelog
This commit is contained in:
Thomas Kaul 2023-08-17 20:23:23 +02:00 committed by GitHub
parent 18835149e2
commit 0fd3db3228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 22 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed the rows with cash positions in the holdings table
- Fixed an issue with the date parsing in the historical market data editor of the admin control panel - Fixed an issue with the date parsing in the historical market data editor of the admin control panel
## 1.300.0 - 2023-08-11 ## 1.300.0 - 2023-08-11

View File

@ -101,7 +101,7 @@ export class HomeSummaryComponent implements OnDestroy, OnInit {
this.isLoading = true; this.isLoading = true;
this.dataService this.dataService
.fetchPortfolioDetails({}) .fetchPortfolioDetails()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ summary }) => { .subscribe(({ summary }) => {
this.summary = summary; this.summary = summary;

View File

@ -72,7 +72,13 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
public positions: { public positions: {
[symbol: string]: Pick< [symbol: string]: Pick<
PortfolioPosition, PortfolioPosition,
'assetClass' | 'assetSubClass' | 'currency' | 'exchange' | 'name' | 'assetClass'
| 'assetClassLabel'
| 'assetSubClass'
| 'assetSubClassLabel'
| 'currency'
| 'exchange'
| 'name'
> & { etfProvider: string; value: number }; > & { etfProvider: string; value: number };
}; };
public sectors: { public sectors: {
@ -341,7 +347,9 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
this.positions[symbol] = { this.positions[symbol] = {
value, value,
assetClass: position.assetClass, assetClass: position.assetClass,
assetClassLabel: translate(position.assetClass),
assetSubClass: position.assetSubClass, assetSubClass: position.assetSubClass,
assetSubClassLabel: translate(position.assetSubClass),
currency: position.currency, currency: position.currency,
etfProvider: this.extractEtfProvider({ etfProvider: this.extractEtfProvider({
assetSubClass: position.assetSubClass, assetSubClass: position.assetSubClass,

View File

@ -93,7 +93,7 @@
[baseCurrency]="user?.settings?.baseCurrency" [baseCurrency]="user?.settings?.baseCurrency"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView" [isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[keys]="['assetClass', 'assetSubClass']" [keys]="['assetClassLabel', 'assetSubClassLabel']"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[positions]="positions" [positions]="positions"
></gf-portfolio-proportion-chart> ></gf-portfolio-proportion-chart>

View File

@ -44,7 +44,7 @@ export class FirePageComponent implements OnDestroy, OnInit {
this.deviceType = this.deviceService.getDeviceInfo().deviceType; this.deviceType = this.deviceService.getDeviceInfo().deviceType;
this.dataService this.dataService
.fetchPortfolioDetails({}) .fetchPortfolioDetails()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ summary }) => { .subscribe(({ summary }) => {
if (summary.cash === null || summary.currentValue === null) { if (summary.cash === null || summary.currentValue === null) {

View File

@ -164,7 +164,11 @@ export class HoldingsPageComponent implements OnDestroy, OnInit {
for (const [symbol, position] of Object.entries( for (const [symbol, position] of Object.entries(
this.portfolioDetails.holdings this.portfolioDetails.holdings
)) { )) {
this.positionsArray.push(position); this.positionsArray.push({
...position,
assetClassLabel: translate(position.assetClass),
assetSubClassLabel: translate(position.assetSubClass)
});
} }
} }

View File

@ -341,7 +341,7 @@ export class DataService {
filters filters
}: { }: {
filters?: Filter[]; filters?: Filter[];
}): Observable<PortfolioDetails> { } = {}): Observable<PortfolioDetails> {
return this.http return this.http
.get<any>('/api/v1/portfolio/details', { .get<any>('/api/v1/portfolio/details', {
params: this.buildFiltersAsQueryParams({ filters }) params: this.buildFiltersAsQueryParams({ filters })
@ -356,14 +356,6 @@ export class DataService {
if (response.holdings) { if (response.holdings) {
for (const symbol of Object.keys(response.holdings)) { for (const symbol of Object.keys(response.holdings)) {
response.holdings[symbol].assetClass = translate(
response.holdings[symbol].assetClass
);
response.holdings[symbol].assetSubClass = translate(
response.holdings[symbol].assetSubClass
);
response.holdings[symbol].dateOfFirstActivity = response.holdings[ response.holdings[symbol].dateOfFirstActivity = response.holdings[
symbol symbol
].dateOfFirstActivity ].dateOfFirstActivity

View File

@ -7,7 +7,9 @@ import { Sector } from './sector.interface';
export interface PortfolioPosition { export interface PortfolioPosition {
allocationInPercentage: number; allocationInPercentage: number;
assetClass?: AssetClass; assetClass?: AssetClass;
assetClassLabel?: string;
assetSubClass?: AssetSubClass | 'CASH'; assetSubClass?: AssetSubClass | 'CASH';
assetSubClassLabel?: string;
countries: Country[]; countries: Country[];
currency: string; currency: string;
dataSource: DataSource; dataSource: DataSource;

View File

@ -28,8 +28,11 @@
<ng-container i18n>Name</ng-container> <ng-container i18n>Name</ng-container>
</th> </th>
<td *matCellDef="let element" class="line-height-1 px-1" mat-cell> <td *matCellDef="let element" class="line-height-1 px-1" mat-cell>
<div *ngIf="element.name !== element.symbol" class="text-truncate"> <div class="text-truncate">
{{ element.name }} {{ element.name }}
<span *ngIf="element.name === element.symbol"
>({{ element.assetSubClassLabel }})</span
>
</div> </div>
<div> <div>
<small class="text-muted">{{ element.symbol }}</small> <small class="text-muted">{{ element.symbol }}</small>

View File

@ -14,12 +14,6 @@
} }
} }
} }
.mat-mdc-row {
&.cursor-pointer {
cursor: pointer;
}
}
} }
} }
} }

View File

@ -41,7 +41,7 @@ export class HoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
public dataSource: MatTableDataSource<PortfolioPosition> = public dataSource: MatTableDataSource<PortfolioPosition> =
new MatTableDataSource(); new MatTableDataSource();
public displayedColumns = []; public displayedColumns = [];
public ignoreAssetSubClasses = [AssetClass.CASH.toString()]; public ignoreAssetSubClasses = [AssetClass.CASH];
public isLoading = true; public isLoading = true;
public routeQueryParams: Subscription; public routeQueryParams: Subscription;