Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix exception in admin market data detail component (#3731)
Thomas Kaul1204240ed09e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 448e1c5a66..a1bb6525f4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Fixed an issue in the view mode toggle of the holdings tab on the home page (experimental)- Fixed an issue on the portfolio activities page by loading the data only once- Fixed an issue in the carousel component for the testimonial section on the landing page+- Handled an exception in the historical market data component of the asset profile details dialog in the admin control panel## 2.105.0 - 2024-08-21diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.tsindex 7e7168a6e5..a1261c37f9 100644--- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts+++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.ts@@ -93,52 +93,52 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {};});- let date = parseISO(this.dateOfFirstActivity);-- const missingMarketData: Partial<MarketData>[] = [];-- if (this.historicalDataItems?.[0]?.date) {- while (- isBefore(- date,- parse(this.historicalDataItems[0].date, DATE_FORMAT, new Date())- )- ) {- missingMarketData.push({- date,- marketPrice: undefined- });-- date = addDays(date, 1);+ if (this.dateOfFirstActivity) {+ let date = parseISO(this.dateOfFirstActivity);++ const missingMarketData: Partial<MarketData>[] = [];++ if (this.historicalDataItems?.[0]?.date) {+ while (+ isBefore(+ date,+ parse(this.historicalDataItems[0].date, DATE_FORMAT, new Date())+ )+ ) {+ missingMarketData.push({+ date,+ marketPrice: undefined+ });++ date = addDays(date, 1);+ }}- }- const marketDataItems = [...missingMarketData, ...this.marketData];+ const marketDataItems = [...missingMarketData, ...this.marketData];- if (!isToday(last(marketDataItems)?.date)) {- marketDataItems.push({ date: new Date() });- }+ if (!isToday(last(marketDataItems)?.date)) {+ marketDataItems.push({ date: new Date() });+ }- this.marketDataByMonth = {};+ this.marketDataByMonth = {};- for (const marketDataItem of marketDataItems) {- const currentDay = parseInt(format(marketDataItem.date, 'd'), 10);- const key = format(marketDataItem.date, 'yyyy-MM');+ for (const marketDataItem of marketDataItems) {+ const currentDay = parseInt(format(marketDataItem.date, 'd'), 10);+ const key = format(marketDataItem.date, 'yyyy-MM');- if (!this.marketDataByMonth[key]) {- this.marketDataByMonth[key] = {};- }+ if (!this.marketDataByMonth[key]) {+ this.marketDataByMonth[key] = {};+ }- this.marketDataByMonth[key][- currentDay < 10 ? `0${currentDay}` : currentDay- ] = {- date: marketDataItem.date,- day: currentDay,- marketPrice: marketDataItem.marketPrice- };- }+ this.marketDataByMonth[key][+ currentDay < 10 ? `0${currentDay}` : currentDay+ ] = {+ date: marketDataItem.date,+ day: currentDay,+ marketPrice: marketDataItem.marketPrice+ };+ }- if (this.dateOfFirstActivity) {// Fill up missing monthsconst dates = Object.keys(this.marketDataByMonth).sort();const startDate = min([