Browse Source

Address review feedback for holding detail pagination

pull/6874/head
goat 1 week ago
parent
commit
bfa4976dff
  1. 1
      CHANGELOG.md
  2. 33
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  3. 4
      libs/ui/src/lib/services/data.service.ts

1
CHANGELOG.md

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Improved pagination for activities in the holding detail dialog
- Resolved an issue with the cash balance calculation of an account for `SELL` activities to ensure fees are correctly subtracted - Resolved an issue with the cash balance calculation of an account for `SELL` activities to ensure fees are correctly subtracted
- Resolved an exception in the portfolio details endpoint when an asset profile is unmatched - Resolved an exception in the portfolio details endpoint when an asset profile is unmatched

33
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -182,10 +182,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
const filters: Filter[] = [ const filters = this.getActivityFilters();
{ id: this.data.dataSource, type: 'DATA_SOURCE' },
{ id: this.data.symbol, type: 'SYMBOL' }
];
this.holdingForm = this.formBuilder.group({ this.holdingForm = this.formBuilder.group({
tags: [] as string[] tags: [] as string[]
@ -536,6 +533,12 @@ export class GfHoldingDetailDialogComponent implements OnInit {
}); });
} }
public onChangePage(page: PageEvent) {
this.pageIndex = page.pageIndex;
this.fetchActivities();
}
public onCloneActivity(aActivity: Activity) { public onCloneActivity(aActivity: Activity) {
this.router.navigate( this.router.navigate(
internalRoutes.portfolio.subRoutes.activities.routerLink, internalRoutes.portfolio.subRoutes.activities.routerLink,
@ -608,12 +611,6 @@ export class GfHoldingDetailDialogComponent implements OnInit {
} }
} }
public onChangePage(page: PageEvent) {
this.pageIndex = page.pageIndex;
this.fetchActivities();
}
public onUpdateActivity(aActivity: Activity) { public onUpdateActivity(aActivity: Activity) {
this.router.navigate( this.router.navigate(
internalRoutes.portfolio.subRoutes.activities.routerLink, internalRoutes.portfolio.subRoutes.activities.routerLink,
@ -625,7 +622,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this.dialogRef.close(); this.dialogRef.close();
} }
private fetchActivities(filters = this.getActivityFilters()) { private fetchActivities(filters: Filter[] = this.getActivityFilters()) {
this.dataService this.dataService
.fetchActivities({ .fetchActivities({
filters, filters,
@ -642,13 +639,6 @@ export class GfHoldingDetailDialogComponent implements OnInit {
}); });
} }
private getActivityFilters(): Filter[] {
return [
{ id: this.data.dataSource, type: 'DATA_SOURCE' },
{ id: this.data.symbol, type: 'SYMBOL' }
];
}
private fetchMarketData() { private fetchMarketData() {
this.dataService this.dataService
.fetchMarketDataBySymbol({ .fetchMarketDataBySymbol({
@ -671,4 +661,11 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });
} }
private getActivityFilters(): Filter[] {
return [
{ id: this.data.dataSource, type: 'DATA_SOURCE' },
{ id: this.data.symbol, type: 'SYMBOL' }
];
}
} }

4
libs/ui/src/lib/services/data.service.ts

@ -235,7 +235,7 @@ export class DataService {
params = params.append('range', range); params = params.append('range', range);
} }
if (skip !== undefined) { if (skip) {
params = params.append('skip', skip); params = params.append('skip', skip);
} }
@ -247,7 +247,7 @@ export class DataService {
params = params.append('sortDirection', sortDirection); params = params.append('sortDirection', sortDirection);
} }
if (take !== undefined) { if (take) {
params = params.append('take', take); params = params.append('take', take);
} }

Loading…
Cancel
Save