1
0
mirror of https://github.com/Fayorg/calendrier-avant.git synced 2026-05-27 17:18:38 +02:00

fix: refactored server functions names

This commit is contained in:
2023-12-20 14:44:36 +01:00
parent 7c89ca8338
commit 771d9a8637
7 changed files with 13 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
'use client';
import { getActiveTestWithGrade } from '@/actions/mangeTest';
import { getFirstActiveTestWithGrade } from '@/actions/mangeTest';
import { TestCard } from '@/components/custom';
import { Session } from 'next-auth';
import { signOut } from 'next-auth/react';
@@ -14,7 +14,7 @@ export function TodayTest({ session }: { session: Session }) {
const [activeTest, setActiveTest] = useState<{ data: any | null; error: Error | null; isLoading: boolean }>({ isLoading: true, data: null, error: null });
useEffect(() => {
getActiveTestWithGrade(new Date(), session.user.id)
getFirstActiveTestWithGrade(new Date(), session.user.id)
.catch((err) => setActiveTest({ data: null, error: err, isLoading: false }))
.then((data) => setActiveTest({ data, error: null, isLoading: false }));
}, [session.user.id]);

View File

@@ -2,7 +2,7 @@ import Image from 'next/image';
import Logo from '/images/logo.svg';
import { getAuthServerSession } from '@/lib/authenticate';
import { redirect } from 'next/navigation';
import { getActiveTest } from '@/actions/mangeTest';
import { getFirstActiveTest } from '@/actions/mangeTest';
import { TodayTest } from './TodayTest';
export default async function Play() {
@@ -13,7 +13,7 @@ export default async function Play() {
}
const now = new Date();
const todayTest = await getActiveTest(now);
const todayTest = await getFirstActiveTest(now);
return (
<div className={'w-full h-[100vh] text-[#F0F0F0] bg-black p-12 flex flex-col items-center justify-center gap-y-28'}>

View File

@@ -3,7 +3,7 @@ import { Chart } from '@components/custom/chart';
import logo from '@images/logo.svg';
import Image from 'next/image';
import ginger from '@images/ginger.png';
import { getResults, getTeacherResult, Results } from '@/actions/results';
import { getStudentResults, getTeacherResult, Results } from '@/actions/results';
import { useEffect, useState } from 'react';
export default function Page({ params }: { params: { id: string } }) {
@@ -17,7 +17,7 @@ export default function Page({ params }: { params: { id: string } }) {
.then((res) => setTeacherGrade(res?.grade || 0))
.catch((err) => console.error(err));
getResults(testId)
getStudentResults(testId)
.then((res) => setData(res))
.catch((err) => console.error(err));
}