Skip to content

Commit

Permalink
fix(Field service reports): exclude overseers when adding publishers
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Sep 10, 2024
1 parent e9b5f85 commit 93524c2
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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(
Expand Down

0 comments on commit 93524c2

Please sign in to comment.