From bbce780609404b664bf4c758c3981f22c503f9bc Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 22 Aug 2026 13:34:47 +0200 Subject: [PATCH] fix: update toggleSelect to select only 4 authors --- .../persons-results/persons-results.component.html | 2 +- .../persons-results/persons-results.component.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html index 3a656f21..5597647d 100644 --- a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html +++ b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.html @@ -29,7 +29,7 @@ + (change)="toggleSelect(author, $event)" /> diff --git a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts index a57b3e5d..8c8ef351 100644 --- a/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts +++ b/webapp/src/app/modules/keywords-search/search-results/persons-results/persons-results.component.ts @@ -6,7 +6,10 @@ import { DecimalPipe } from '@angular/common'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; -import { MatCheckboxModule } from '@angular/material/checkbox'; +import { + MatCheckboxChange, + MatCheckboxModule, +} from '@angular/material/checkbox'; import { MatIconModule } from '@angular/material/icon'; import { MatSnackBar } from '@angular/material/snack-bar'; import { FormsModule } from '@angular/forms'; @@ -466,7 +469,7 @@ export class KeywordsToPersonsResultsComponent implements OnInit { return this.selectedIds().includes(this.authorProfileId(author)); } - toggleSelect(author: RankedAuthor): void { + toggleSelect(author: RankedAuthor, event?: MatCheckboxChange): void { const id = this.authorProfileId(author); const current = this.selectedIds(); @@ -476,6 +479,11 @@ export class KeywordsToPersonsResultsComponent implements OnInit { } if (current.length >= this.MAX_SELECTED) { + // the checkbox already toggled itself, so revert it: the [checked] input + // does not change here and would leave the box visually ticked + if (event) { + event.source.checked = false; + } this.snackBar.open( `Es können maximal ${this.MAX_SELECTED} Autoren verglichen werden.`, 'OK',