Solved another bug
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
|
import { CorporateUser, User } from "@/interfaces/user";
|
||||||
import client from "@/lib/mongodb";
|
import client from "@/lib/mongodb";
|
||||||
|
import { getLinkedUsers } from "@/utils/users.be";
|
||||||
|
import { uniqBy } from "lodash";
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
import { v4 } from "uuid";
|
||||||
|
import fs from 'fs'
|
||||||
|
import { findBy, mapBy } from "@/utils";
|
||||||
|
import { addUsersToEntity, getEntitiesWithRoles } from "@/utils/entities.be";
|
||||||
|
|
||||||
const db = client.db(process.env.MONGODB_DB);
|
const db = client.db(process.env.MONGODB_DB);
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export default function Dashboard({ user, users, userCounts, entities, assignmen
|
|||||||
|
|
||||||
const totalCount = useMemo(() =>
|
const totalCount = useMemo(() =>
|
||||||
userCounts.corporate + userCounts.mastercorporate + userCounts.student + userCounts.teacher, [userCounts])
|
userCounts.corporate + userCounts.mastercorporate + userCounts.student + userCounts.teacher, [userCounts])
|
||||||
const totalLicenses = useMemo(() => entities.reduce((acc, curr) => acc + curr.licenses, 0), [entities])
|
const totalLicenses = useMemo(() => entities.reduce((acc, curr) => acc + parseInt(curr.licenses.toString()), 0), [entities])
|
||||||
|
|
||||||
const allowedEntityStatistics = useAllowedEntities(user, entities, 'view_entity_statistics')
|
const allowedEntityStatistics = useAllowedEntities(user, entities, 'view_entity_statistics')
|
||||||
const allowedStudentPerformance = useAllowedEntities(user, entities, 'view_student_performance')
|
const allowedStudentPerformance = useAllowedEntities(user, entities, 'view_student_performance')
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ export default function Dashboard({ user, users, userCounts, entities, assignmen
|
|||||||
const totalCount = useMemo(() =>
|
const totalCount = useMemo(() =>
|
||||||
userCounts.corporate + userCounts.mastercorporate + userCounts.student + userCounts.teacher, [userCounts])
|
userCounts.corporate + userCounts.mastercorporate + userCounts.student + userCounts.teacher, [userCounts])
|
||||||
|
|
||||||
console.log(userCounts)
|
|
||||||
const totalLicenses = useMemo(() => entities.reduce((acc, curr) => acc + parseInt(curr.licenses.toString()), 0), [entities])
|
const totalLicenses = useMemo(() => entities.reduce((acc, curr) => acc + parseInt(curr.licenses.toString()), 0), [entities])
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
Reference in New Issue
Block a user