From d5e64eaed41fedbf69b7c04c5c3a5fe7120fde24 Mon Sep 17 00:00:00 2001 From: Ivan Kruglov <4630547+ikruglov@users.noreply.github.com> Date: Wed, 15 Jan 2025 20:34:03 +0100 Subject: [PATCH] Bugfix/fix issue with import of activities with type FEE (#4187) * Fix import of activity with type FEE * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/import/import.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e2ff3900..a20c76c39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue with the import of activities with type `FEE` (where unit price is `0`) - Fixed an issue with the renaming of activities with type `FEE`, `INTEREST`, `ITEM` or `LIABILITY` - Handled an exception in the scraper configuration introduced by the migration from `got` to `fetch` diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 3b7290b43..eb1b841c4 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -30,7 +30,7 @@ import { Injectable } from '@nestjs/common'; import { DataSource, Prisma, SymbolProfile } from '@prisma/client'; import { Big } from 'big.js'; import { endOfToday, format, isAfter, isSameSecond, parseISO } from 'date-fns'; -import { uniqBy } from 'lodash'; +import { isNumber, uniqBy } from 'lodash'; import { v4 as uuidv4 } from 'uuid'; @Injectable() @@ -328,7 +328,7 @@ export class ImportService { date ); - if (!unitPrice) { + if (!isNumber(unitPrice)) { throw new Error( `activities.${index} historical exchange rate at ${format( date,