Tried to solve some more issues with counts

This commit is contained in:
Tiago Ribeiro
2024-09-08 19:56:44 +01:00
parent 298901a642
commit b7349b5df8
2 changed files with 5 additions and 2 deletions

View File

@@ -64,7 +64,10 @@ export const getUserNamedGroup = async (id: string, name: string) => {
};
export const getUsersGroups = async (ids: string[]) => {
return await db.collection("groups").find<Group>({admin: ids}).toArray();
return await db
.collection("groups")
.find<Group>({admin: {$in: ids}})
.toArray();
};
export const getAllAssignersByCorporate = async (corporateID: string): Promise<string[]> => {

View File

@@ -56,7 +56,7 @@ export async function getLinkedUsers(
const participants = uniq([
...adminGroups.flatMap((x) => x.participants),
...groups.flat().flatMap((x) => x.participants),
...(userType === "mastercorporate" ? groups.flat().flatMap((x) => x.participants) : []),
...(userType === "teacher" ? belongingGroups.flatMap((x) => x.participants) : []),
]);