Browse Source
			
			
			FIX #1951: select checkbox state fix for duplicates (#1958)
			
				* FIX #1951: select checkbox state fix for duplicates
* Update changelog
			
			
				pull/1965/head
			
			
		 
		
			
				
					
						 Visrut
					
					3 years ago
						Visrut
					
					3 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 4 changed files with 
21 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.component.ts
				
- 
					
					
					 
					libs/ui/src/lib/activities-table/activities-table.component.html
				
- 
					
					
					 
					libs/ui/src/lib/activities-table/activities-table.component.ts
				
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | - Added `FINANCIAL_MODELING_PREP` as a new data source type |  |  | - Added `FINANCIAL_MODELING_PREP` as a new data source type | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | ### Fixed | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | - Improved the _Select all_ activities checkbox state after importing activities including a duplicate | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | ## Unreleased | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | ### Changed |  |  | ### Changed | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | - Improved the market price on the first buy date in the chart of the position detail dialog |  |  | - Improved the market price on the first buy date in the chart of the position detail dialog | 
			
		
	
	
		
		
			
				
					|  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -235,8 +235,10 @@ export class ImportActivitiesDialog implements OnDestroy { | 
			
		
	
		
		
			
				
					|  |  |     input.click(); |  |  |     input.click(); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |   public updateSelection(data: Activity[]) { |  |  |   public updateSelection(activities: Activity[]) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |     this.selectedActivities = data; |  |  |     this.selectedActivities = activities.filter(({ isDuplicate }) => { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |       return !isDuplicate; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |   public ngOnDestroy() { |  |  |   public ngOnDestroy() { | 
			
		
	
	
		
		
			
				
					|  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -77,7 +77,12 @@ | 
			
		
	
		
		
			
				
					|  |  |       <th *matHeaderCellDef class="px-1" mat-header-cell> |  |  |       <th *matHeaderCellDef class="px-1" mat-header-cell> | 
			
		
	
		
		
			
				
					|  |  |         <mat-checkbox |  |  |         <mat-checkbox | 
			
		
	
		
		
			
				
					|  |  |           color="primary" |  |  |           color="primary" | 
			
		
	
		
		
			
				
					
					|  |  |           [checked]="selectedRows.hasValue() && areAllRowsSelected()" |  |  |           [checked]=" | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |             areAllRowsSelected() && | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             !hasDuplicateActivity && | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             selectedRows.hasValue() | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           " | 
			
		
	
		
		
			
				
					|  |  |  |  |  |           [disabled]="hasDuplicateActivity" | 
			
		
	
		
		
			
				
					|  |  |           [indeterminate]="selectedRows.hasValue() && !areAllRowsSelected()" |  |  |           [indeterminate]="selectedRows.hasValue() && !areAllRowsSelected()" | 
			
		
	
		
		
			
				
					|  |  |           (change)="$event ? toggleAllRows() : null" |  |  |           (change)="$event ? toggleAllRows() : null" | 
			
		
	
		
		
			
				
					|  |  |         ></mat-checkbox> |  |  |         ></mat-checkbox> | 
			
		
	
	
		
		
			
				
					|  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -66,6 +66,7 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit { | 
			
		
	
		
		
			
				
					|  |  |   public endOfToday = endOfToday(); |  |  |   public endOfToday = endOfToday(); | 
			
		
	
		
		
			
				
					|  |  |   public filters$ = new Subject<Filter[]>(); |  |  |   public filters$ = new Subject<Filter[]>(); | 
			
		
	
		
		
			
				
					|  |  |   public hasDrafts = false; |  |  |   public hasDrafts = false; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |   public hasDuplicateActivity = false; | 
			
		
	
		
		
			
				
					|  |  |   public isAfter = isAfter; |  |  |   public isAfter = isAfter; | 
			
		
	
		
		
			
				
					|  |  |   public isLoading = true; |  |  |   public isLoading = true; | 
			
		
	
		
		
			
				
					|  |  |   public isUUID = isUUID; |  |  |   public isUUID = isUUID; | 
			
		
	
	
		
		
			
				
					|  | @ -97,6 +98,10 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit { | 
			
		
	
		
		
			
				
					|  |  |           this.selectedActivities.emit(selectedRows.source.selected); |  |  |           this.selectedActivities.emit(selectedRows.source.selected); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     this.hasDuplicateActivity = this.activities.some(({ isDuplicate }) => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |       return isDuplicate; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					|  |  |   } |  |  |   } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |   public areAllRowsSelected() { |  |  |   public areAllRowsSelected() { | 
			
		
	
	
		
		
			
				
					|  | 
 |