Browse Source
			
			
			Feature/skip data gathering for manual data source (#2379)
			
				* Skip data gathering
* Update changelog
			
			
				pull/2380/head
			
			
		 
		
			
				
					
						 Thomas Kaul
					
					2 years ago
						Thomas Kaul
					
					2 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 4 changed files with 
25 additions and 
14 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					apps/api/src/app/order/order.controller.ts
				
- 
					
					
					 
					apps/api/src/app/order/order.service.ts
				
- 
					
					
					 
					apps/api/src/services/data-gathering/data-gathering.service.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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, | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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; | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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 = | 
			
		
	
	
		
			
				
					|  |  | 
 |