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) { if (groupBy) {
dividends = this.getDividendsByGroup(dividends, groupBy); dividends = this.getDividendsByGroup({ aDividends: dividends, groupBy });
} }
const startDate = this.getStartDate( const startDate = this.getStartDate(
@ -1269,10 +1269,13 @@ export class PortfolioService {
); );
} }
private getDividendsByGroup( private getDividendsByGroup({
aDividends: InvestmentItem[], aDividends,
groupBy: GroupBy groupBy
): InvestmentItem[] { }: {
aDividends: InvestmentItem[];
groupBy: GroupBy;
}): InvestmentItem[] {
if (aDividends.length === 0) { if (aDividends.length === 0) {
return []; 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 dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
public daysInMarket: number; public daysInMarket: number;
public deviceType: string; public deviceType: string;
public dividendsByMonth: InvestmentItem[]; public dividendsByGroup: InvestmentItem[];
public dividendTimelineDataLabel = $localize`Dividend`; public dividendTimelineDataLabel = $localize`Dividend`;
public filters$ = new Subject<Filter[]>(); public filters$ = new Subject<Filter[]>();
public firstOrderDate: Date; public firstOrderDate: Date;
public hasImpersonationId: boolean; public hasImpersonationId: boolean;
public investments: InvestmentItem[]; public investments: InvestmentItem[];
public investmentTimelineDataLabel = $localize`Deposit`; public investmentTimelineDataLabel = $localize`Deposit`;
public investmentsByMonth: InvestmentItem[]; public investmentsByGroup: InvestmentItem[];
public isLoadingBenchmarkComparator: boolean; public isLoadingBenchmarkComparator: boolean;
public isLoadingInvestmentChart: boolean; public isLoadingInvestmentChart: boolean;
public mode: GroupBy = 'month'; public mode: GroupBy = 'month';
@ -219,7 +219,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
}) })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ dividends }) => { .subscribe(({ dividends }) => {
this.dividendsByMonth = dividends; this.dividendsByGroup = dividends;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });
@ -232,7 +232,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
}) })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ investments }) => { .subscribe(({ investments }) => {
this.investmentsByMonth = investments; this.investmentsByGroup = investments;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });

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

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

Loading…
Cancel
Save