From b637993ba189e571cac42dd7cfd3a3be5fdd1ee5 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Tue, 3 Sep 2024 20:53:28 +0200 Subject: [PATCH] clean code --- src/app/components/add-task/add-task.component.ts | 2 +- .../components/add-task/assigned/assigned.component.ts | 4 +--- src/app/services/firebase.service.ts | 8 +++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/app/components/add-task/add-task.component.ts b/src/app/components/add-task/add-task.component.ts index 8887c53..c5b9f5d 100644 --- a/src/app/components/add-task/add-task.component.ts +++ b/src/app/components/add-task/add-task.component.ts @@ -134,7 +134,7 @@ export class AddTaskComponent implements OnInit { searchTask(taskCreator: string): void { this.updateSearchInput(); this.filteredUsers = this.firebaseService - .getAllUserWithoutGuestCurrentUserAndCreator(taskCreator) + .getFilteredUsers(taskCreator) .filter( (user) => user.firstName.toLowerCase().includes(this.searchValue) || diff --git a/src/app/components/add-task/assigned/assigned.component.ts b/src/app/components/add-task/assigned/assigned.component.ts index 65f170d..3311c37 100644 --- a/src/app/components/add-task/assigned/assigned.component.ts +++ b/src/app/components/add-task/assigned/assigned.component.ts @@ -60,9 +60,7 @@ export class AssignedComponent { if (this.searchInput) { return this.filteredUsers; } else { - return this.firebaseService.getAllUserWithoutGuestCurrentUserAndCreator( - this.taskCreator - ); + return this.firebaseService.getFilteredUsers(this.taskCreator); } } } diff --git a/src/app/services/firebase.service.ts b/src/app/services/firebase.service.ts index 5501630..0763d2a 100644 --- a/src/app/services/firebase.service.ts +++ b/src/app/services/firebase.service.ts @@ -113,14 +113,12 @@ export class FirebaseService implements OnDestroy { return this.getAllUsers().filter((user) => user.initials !== 'G'); } - getAllUserWithoutGuestCurrentUserAndCreator(taskCreator: string): User[] { + getFilteredUsers(taskCreator: string): User[] { const currentUser = this.getCurrentUserId(); - const usersWithoutGuestAndCurrent = this.getAllUsers().filter( + const filteredUsers = this.getAllUsers().filter( (user) => user.initials !== 'G' && user.id !== currentUser ); - return usersWithoutGuestAndCurrent.filter( - (user) => user.id !== taskCreator - ); + return filteredUsers.filter((user) => user.id !== taskCreator); } getUserDataFromId(userId: string): User[] {