FIX #1951: select checkbox state fix for duplicates (#1958)

* FIX #1951: select checkbox state fix for duplicates

* Update changelog
pull/1965/head
Visrut 1 year ago committed by GitHub
parent 0af528b649
commit 9c30139b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
### Fixed
- Improved the _Select all_ activities checkbox state after importing activities including a duplicate
## Unreleased
### Changed
- 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();
}
public updateSelection(data: Activity[]) {
this.selectedActivities = data;
public updateSelection(activities: Activity[]) {
this.selectedActivities = activities.filter(({ isDuplicate }) => {
return !isDuplicate;
});
}
public ngOnDestroy() {

@ -77,7 +77,12 @@
<th *matHeaderCellDef class="px-1" mat-header-cell>
<mat-checkbox
color="primary"
[checked]="selectedRows.hasValue() && areAllRowsSelected()"
[checked]="
areAllRowsSelected() &&
!hasDuplicateActivity &&
selectedRows.hasValue()
"
[disabled]="hasDuplicateActivity"
[indeterminate]="selectedRows.hasValue() && !areAllRowsSelected()"
(change)="$event ? toggleAllRows() : null"
></mat-checkbox>

@ -66,6 +66,7 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit {
public endOfToday = endOfToday();
public filters$ = new Subject<Filter[]>();
public hasDrafts = false;
public hasDuplicateActivity = false;
public isAfter = isAfter;
public isLoading = true;
public isUUID = isUUID;
@ -97,6 +98,10 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit {
this.selectedActivities.emit(selectedRows.source.selected);
});
}
this.hasDuplicateActivity = this.activities.some(({ isDuplicate }) => {
return isDuplicate;
});
}
public areAllRowsSelected() {

Loading…
Cancel
Save