Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/skip data gathering for manual data source (#2379)

Thomas Kaule2e4c9be3c74
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e44452949..bc511f812c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for dates in `DD.MM.YYYY` format in the activities import
- Set up the language localization for Türkçe (`tr`)
+### Changed
+
+- Skipped creating queue jobs for asset profiles with `MANUAL` data source on creating a new activity
+
### Fixed
- Fixed an issue with the cash position in the holdings table
diff --git a/apps/api/src/app/order/order.controller.ts b/apps/api/src/app/order/order.controller.ts
index 0e617462e1..be6a6bead4 100644
--- a/apps/api/src/app/order/order.controller.ts
+++ b/apps/api/src/app/order/order.controller.ts
@@ -147,8 +147,9 @@ export class OrderController {
userId: this.request.user.id
});
- if (!order.isDraft) {
- // Gather symbol data in the background, if not draft
+ if (data.dataSource && !order.isDraft) {
+ // Gather symbol data in the background, if data source is set
+ // (not MANUAL) and not draft
this.dataGatheringService.gatherSymbols([
{
dataSource: data.dataSource,
diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts
index 3c20f9ba04..f518e0bb32 100644
--- a/apps/api/src/app/order/order.service.ts
+++ b/apps/api/src/app/order/order.service.ts
@@ -123,20 +123,22 @@ export class OrderService {
};
}
- this.dataGatheringService.addJobToQueue({
- data: {
- dataSource: data.SymbolProfile.connectOrCreate.create.dataSource,
- symbol: data.SymbolProfile.connectOrCreate.create.symbol
- },
- name: GATHER_ASSET_PROFILE_PROCESS,
- opts: {
- ...GATHER_ASSET_PROFILE_PROCESS_OPTIONS,
- jobId: getAssetProfileIdentifier({
+ if (data.SymbolProfile.connectOrCreate.create.dataSource !== 'MANUAL') {
+ this.dataGatheringService.addJobToQueue({
+ data: {
dataSource: data.SymbolProfile.connectOrCreate.create.dataSource,
symbol: data.SymbolProfile.connectOrCreate.create.symbol
- })
- }
- });
+ },
+ name: GATHER_ASSET_PROFILE_PROCESS,
+ opts: {
+ ...GATHER_ASSET_PROFILE_PROCESS_OPTIONS,
+ jobId: getAssetProfileIdentifier({
+ dataSource: data.SymbolProfile.connectOrCreate.create.dataSource,
+ symbol: data.SymbolProfile.connectOrCreate.create.symbol
+ })
+ }
+ });
+ }
delete data.accountId;
delete data.assetClass;
diff --git a/apps/api/src/services/data-gathering/data-gathering.service.ts b/apps/api/src/services/data-gathering/data-gathering.service.ts
index 16ca505de7..34645b9eaa 100644
--- a/apps/api/src/services/data-gathering/data-gathering.service.ts
+++ b/apps/api/src/services/data-gathering/data-gathering.service.ts
@@ -127,6 +127,10 @@ export class DataGatheringService {
uniqueAssets = await this.getUniqueAssets();
}
+ if (uniqueAssets.length <= 0) {
+ return;
+ }
+
const assetProfiles =
await this.dataProviderService.getAssetProfiles(uniqueAssets);
const symbolProfiles =