Browse Source
			
			
			Bugfix/exclude drafts from transaction count (#473)
			
				* Fix transactions count (exclude drafts)
* Improve wording (summary page)
* Update changelog
			
			
				pull/474/head
			
			
		 
		
			
				
					
						
						Thomas Kaul
					
					4 years ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 4 changed files with 
26 additions and 
4 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/app/account/account.service.ts
				
 
			
				- 
					
					
					 
					apps/api/src/app/portfolio/portfolio.service.ts
				
 
			
				- 
					
					
					 
					apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Unreleased | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Fixed | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Fixed the transactions count in the accounts table (exclude drafts) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## 1.76.0 - 14.11.2021 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Added | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -85,7 +85,15 @@ export class AccountService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return accounts.map((account) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      const result = { ...account, transactionCount: account.Order.length }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      let transactionCount = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      for (const order of account.Order) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!order.isDraft) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          transactionCount += 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      const result = { ...account, transactionCount }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      delete result.Order; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -94,14 +94,22 @@ export class PortfolioService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    const userCurrency = this.request.user.Settings.currency; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    return accounts.map((account) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      let transactionCount = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      for (const order of account.Order) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!order.isDraft) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          transactionCount += 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      const result = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ...account, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        transactionCount, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        convertedBalance: this.exchangeRateDataService.toCurrency( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          account.balance, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          account.currency, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          userCurrency | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        transactionCount: account.Order.length, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        value: details.accounts[account.name]?.current ?? 0 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -77,7 +77,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  <div class="row px-3 py-1"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="d-flex flex-grow-1" i18n> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      Fees for {{ summary?.ordersCount }} {summary?.ordersCount, plural, =1 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      {order} other {orders}} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      {transaction} other {transactions}} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="d-flex justify-content-end"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      <span *ngIf="summary?.fees || summary?.fees === 0" class="mr-1">-</span> | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -132,7 +132,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  </div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  <div class="row px-3 py-1"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="d-flex flex-grow-1" i18n>Cash</div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="d-flex flex-grow-1" i18n>Cash (Buying Power)</div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="d-flex justify-content-end"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      <gf-value | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        class="justify-content-end" | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |