Solved a problem where it was only getting the first 25 students

This commit is contained in:
Tiago Ribeiro
2024-09-11 11:29:48 +01:00
parent 2a10933206
commit 7bfd000213
2 changed files with 2 additions and 30 deletions

View File

@@ -55,6 +55,7 @@ import useUserBalance from "@/hooks/useUserBalance";
import AssignmentsPage from "../views/AssignmentsPage"; import AssignmentsPage from "../views/AssignmentsPage";
import StudentPerformancePage from "./StudentPerformancePage"; import StudentPerformancePage from "./StudentPerformancePage";
import MasterStatistical from "../MasterCorporate/MasterStatistical"; import MasterStatistical from "../MasterCorporate/MasterStatistical";
import MasterStatisticalPage from "./MasterStatisticalPage";
interface Props { interface Props {
user: CorporateUser; user: CorporateUser;
@@ -82,8 +83,6 @@ export default function CorporateDashboard({user, linkedCorporate}: Props) {
const {assignments, isLoading: isAssignmentsLoading, reload: reloadAssignments} = useAssignments({corporate: user.id}); const {assignments, isLoading: isAssignmentsLoading, reload: reloadAssignments} = useAssignments({corporate: user.id});
const {balance} = useUserBalance(); const {balance} = useUserBalance();
useEffect(() => console.log(assignments), [assignments]);
const {users: students, total: totalStudents, reload: reloadStudents, isLoading: isStudentsLoading} = useUsers(studentHash); const {users: students, total: totalStudents, reload: reloadStudents, isLoading: isStudentsLoading} = useUsers(studentHash);
const {users: teachers, total: totalTeachers, reload: reloadTeachers, isLoading: isTeachersLoading} = useUsers(teacherHash); const {users: teachers, total: totalTeachers, reload: reloadTeachers, isLoading: isTeachersLoading} = useUsers(teacherHash);
@@ -123,32 +122,6 @@ export default function CorporateDashboard({user, linkedCorporate}: Props) {
</div> </div>
); );
// this workaround will allow us toreuse the master statistical due to master corporate restraints
// while still being able to use the corporate user
const groupedByNameCorporateIds = useMemo(
() => ({
[user.corporateInformation?.companyInformation?.name || user.name]: [user.id],
}),
[user],
);
const teachersAndStudents = useMemo(() => [...students, ...teachers], [students, teachers]);
const MasterStatisticalPage = () => {
return (
<>
<div className="flex flex-col gap-4">
<div
onClick={() => router.push("/")}
className="flex gap-2 items-center text-mti-purple-light cursor-pointer hover:text-mti-purple-dark transition ease-in-out duration-300">
<BsArrowLeft className="text-xl" />
<span>Back</span>
</div>
<h2 className="text-2xl font-semibold">Master Statistical</h2>
</div>
<MasterStatistical users={teachersAndStudents} corporateUsers={groupedByNameCorporateIds} displaySelection={false} />
</>
);
};
const GroupsList = () => { const GroupsList = () => {
const filter = (x: Group) => x.admin === user.id || x.participants.includes(user.id); const filter = (x: Group) => x.admin === user.id || x.participants.includes(user.id);
@@ -247,7 +220,7 @@ export default function CorporateDashboard({user, linkedCorporate}: Props) {
/> />
); );
if (router.asPath === "/#statistical") return <MasterStatisticalPage />; if (router.asPath === "/#statistical") return <MasterStatisticalPage user={user} />;
return ( return (
<> <>

View File

@@ -17,7 +17,6 @@ export const search = (text: string, fields: string[][], rows: any[]) => {
return fields.some((fieldsKeys) => { return fields.some((fieldsKeys) => {
const value = getFieldValue(fieldsKeys, row); const value = getFieldValue(fieldsKeys, row);
if (typeof value === "string") { if (typeof value === "string") {
console.log(value, searchText, value.toLowerCase().includes(searchText));
return value.toLowerCase().includes(searchText); return value.toLowerCase().includes(searchText);
} }