Skip to content

Commit

Permalink
Fix bug with duplicated alignment possibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
lkleisa committed Jun 3, 2024
1 parent 6b70b7d commit 48e1e9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.
import { TranslateTestingModule } from 'ngx-translate-testing';
import * as de from '../../../../assets/i18n/de.json';
import { ActivatedRoute } from '@angular/router';
import { MatAutocomplete } from '@angular/material/autocomplete';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { AlignmentPossibility } from '../../types/model/AlignmentPossibility';
import { ElementRef } from '@angular/core';

Expand Down Expand Up @@ -104,7 +104,7 @@ describe('ObjectiveDialogComponent', () => {
MatSelectModule,
ReactiveFormsModule,
MatInputModule,
MatAutocomplete,
MatAutocompleteModule,
NoopAnimationsModule,
MatCheckboxModule,
RouterTestingModule,
Expand Down Expand Up @@ -472,7 +472,7 @@ describe('ObjectiveDialogComponent', () => {
MatSelectModule,
ReactiveFormsModule,
MatInputModule,
MatAutocomplete,
MatAutocompleteModule,
NoopAnimationsModule,
MatCheckboxModule,
RouterTestingModule,
Expand Down Expand Up @@ -666,7 +666,7 @@ describe('ObjectiveDialogComponent', () => {
MatSelectModule,
ReactiveFormsModule,
MatInputModule,
MatAutocomplete,
MatAutocompleteModule,
NoopAnimationsModule,
MatCheckboxModule,
RouterTestingModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ export class ObjectiveFormComponent implements OnInit {
}

filter() {
let filterValue = this.input.nativeElement.value.toLowerCase();
let filterValue: string = this.input.nativeElement.value.toLowerCase();
this.alignmentPossibilities$.subscribe((alignmentPossibilities: AlignmentPossibility[]) => {
let matchingTeams = alignmentPossibilities.filter((possibility: AlignmentPossibility) =>
let matchingTeams: AlignmentPossibility[] = alignmentPossibilities.filter((possibility: AlignmentPossibility) =>
possibility.teamName.toLowerCase().includes(filterValue),
);

Expand Down Expand Up @@ -327,7 +327,7 @@ export class ObjectiveFormComponent implements OnInit {
),
}));

let finalArray = matchingTeams.concat(optionList);
let finalArray: AlignmentPossibility[] = filterValue == '' ? matchingTeams : matchingTeams.concat(optionList);
this.filteredOptions$.next([...new Set(finalArray)]);
});
}
Expand Down

0 comments on commit 48e1e9c

Please sign in to comment.