Solved a bug for the master statistical

This commit is contained in:
Tiago Ribeiro
2024-09-10 10:55:02 +01:00
parent 85c8f622ee
commit 33a46c227b
6 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
import client from "@/lib/mongodb";
import {Assignment} from "@/interfaces/results";
import {getAllAssignersByCorporate} from "@/utils/groups.be";
import {Type} from "@/interfaces/user";
const db = client.db(process.env.MONGODB_DB);
@@ -36,10 +37,10 @@ export const getAssignmentsByAssigners = async (ids: string[], startDate?: Date,
.toArray();
};
export const getAssignmentsForCorporates = async (idsList: string[], startDate?: Date, endDate?: Date) => {
export const getAssignmentsForCorporates = async (userType: Type, idsList: string[], startDate?: Date, endDate?: Date) => {
const assigners = await Promise.all(
idsList.map(async (id) => {
const assigners = await getAllAssignersByCorporate(id);
const assigners = await getAllAssignersByCorporate(id, userType);
return {
corporateId: id,
assigners,