From e0c64c65288c1f72a519728f61d26c5c543ffc59 Mon Sep 17 00:00:00 2001 From: rhahao <26148770+rhahao@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:15:34 +0300 Subject: [PATCH] fix(Field service reports): exclude overseers when adding publishers --- .../group_members/useGroupMembers.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/features/congregation/field_service_groups/group_members/useGroupMembers.tsx b/src/features/congregation/field_service_groups/group_members/useGroupMembers.tsx index 222981eed0c..06d8036f964 100644 --- a/src/features/congregation/field_service_groups/group_members/useGroupMembers.tsx +++ b/src/features/congregation/field_service_groups/group_members/useGroupMembers.tsx @@ -36,8 +36,14 @@ const useGroupMembers = ({ group, onChange }: GroupMembersProps) => { .sort((a, b) => a.sort_index - b.sort_index); }, [group]); + const overseers = useMemo(() => { + return group.group_data.members.filter( + (record) => record.isOverseer || record.isAssistant + ); + }, [group]); + const publishers_unassigned = useMemo(() => { - const assigned = [...other_groups_members, ...groups_members]; + const assigned = [...other_groups_members, ...groups_members, ...overseers]; const result = persons.filter( (person) => @@ -55,7 +61,13 @@ const useGroupMembers = ({ group, onChange }: GroupMembersProps) => { ), }; }); - }, [fullnameOption, other_groups_members, groups_members, persons]); + }, [ + fullnameOption, + other_groups_members, + groups_members, + persons, + overseers, + ]); const getIndex = () => { const lastMember = group.group_data.members.findLast(