Browse Source

Add guards

pull/986/head
Thomas 3 years ago
parent
commit
c5a74a458c
  1. 4
      apps/api/src/app/portfolio/portfolio-calculator.ts
  2. 4
      libs/ui/src/lib/activities-filter/activities-filter.component.ts

4
apps/api/src/app/portfolio/portfolio-calculator.ts

@ -56,7 +56,7 @@ export class PortfolioCalculator {
this.currentRateService = currentRateService;
this.orders = orders;
this.orders.sort((a, b) => a.date.localeCompare(b.date));
this.orders.sort((a, b) => a.date?.localeCompare(b.date));
}
public computeTransactionPoints() {
@ -125,7 +125,7 @@ export class PortfolioCalculator {
(transactionPointItem) => transactionPointItem.symbol !== order.symbol
);
newItems.push(currentTransactionPointItem);
newItems.sort((a, b) => a.symbol.localeCompare(b.symbol));
newItems.sort((a, b) => a.symbol?.localeCompare(b.symbol));
if (lastDate !== currentDate || lastTransactionPoint === null) {
lastTransactionPoint = {
date: currentDate,

4
libs/ui/src/lib/activities-filter/activities-filter.component.ts

@ -126,7 +126,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
return filter;
})
.sort((a, b) => a.label.localeCompare(b.label)),
.sort((a, b) => a.label?.localeCompare(b.label)),
(filter) => {
return filter.type;
}
@ -142,7 +142,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
}
return filterGroups
.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.name?.localeCompare(b.name))
.map((filterGroup) => {
return {
...filterGroup,

Loading…
Cancel
Save