clean code

This commit is contained in:
Chneemann 2024-09-03 20:53:28 +02:00
parent fa5bf118de
commit b637993ba1
3 changed files with 5 additions and 9 deletions

View file

@ -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) ||

View file

@ -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);
}
}
}

View file

@ -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[] {