Browse Source

Resolve comments

pull/1568/head
yksolanki9 3 years ago
parent
commit
374a4455ad
  1. 13
      apps/api/src/app/portfolio/portfolio.service.ts
  2. 8
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
  3. 4
      apps/client/src/app/pages/portfolio/analysis/analysis-page.html

13
apps/api/src/app/portfolio/portfolio.service.ts

@ -236,7 +236,7 @@ export class PortfolioService {
});
if (groupBy) {
dividends = this.getDividendsByGroup(dividends, groupBy);
dividends = this.getDividendsByGroup({ aDividends: dividends, groupBy });
}
const startDate = this.getStartDate(
@ -1269,10 +1269,13 @@ export class PortfolioService {
);
}
private getDividendsByGroup(
aDividends: InvestmentItem[],
groupBy: GroupBy
): InvestmentItem[] {
private getDividendsByGroup({
aDividends,
groupBy
}: {
aDividends: InvestmentItem[];
groupBy: GroupBy;
}): InvestmentItem[] {
if (aDividends.length === 0) {
return [];
}

8
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -39,14 +39,14 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public daysInMarket: number;
public deviceType: string;
public dividendsByMonth: InvestmentItem[];
public dividendsByGroup: InvestmentItem[];
public dividendTimelineDataLabel = $localize`Dividend`;
public filters$ = new Subject<Filter[]>();
public firstOrderDate: Date;
public hasImpersonationId: boolean;
public investments: InvestmentItem[];
public investmentTimelineDataLabel = $localize`Deposit`;
public investmentsByMonth: InvestmentItem[];
public investmentsByGroup: InvestmentItem[];
public isLoadingBenchmarkComparator: boolean;
public isLoadingInvestmentChart: boolean;
public mode: GroupBy = 'month';
@ -219,7 +219,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
})
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ dividends }) => {
this.dividendsByMonth = dividends;
this.dividendsByGroup = dividends;
this.changeDetectorRef.markForCheck();
});
@ -232,7 +232,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
})
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ investments }) => {
this.investmentsByMonth = investments;
this.investmentsByGroup = investments;
this.changeDetectorRef.markForCheck();
});

4
apps/client/src/app/pages/portfolio/analysis/analysis-page.html

@ -181,7 +181,7 @@
<gf-investment-chart
class="h-100"
groupBy="month"
[benchmarkDataItems]="investmentsByMonth"
[benchmarkDataItems]="investmentsByGroup"
[benchmarkDataLabel]="investmentTimelineDataLabel"
[currency]="user?.settings?.baseCurrency"
[daysInMarket]="daysInMarket"
@ -218,7 +218,7 @@
<gf-investment-chart
class="h-100"
groupBy="month"
[benchmarkDataItems]="dividendsByMonth"
[benchmarkDataItems]="dividendsByGroup"
[benchmarkDataLabel]="dividendTimelineDataLabel"
[currency]="user?.settings?.baseCurrency"
[daysInMarket]="daysInMarket"

Loading…
Cancel
Save