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

added a timer with custom end alarm sounf

This commit is contained in:
timhaller
2023-12-15 14:52:46 +01:00
parent 47e1204be7
commit f0665d8e42
7 changed files with 64 additions and 4 deletions

View File

@@ -10,12 +10,14 @@ interface data {
}
export default async function Page({ params }: { params: { id: string } }) {
const grades = await Prisma.grade.findMany({ where: { testId: parseInt(params.id) } });
const teacherGrade = await Prisma.grade.findFirst({ where: { testId: parseInt(params.id), user: { isTeacher: true } } });
const grades = await Prisma.grade.findMany({where: {testId: parseInt(params.id), user: {isTeacher: false}}});
const allGrades = ['1', '1.5', '2', '2.5', '3', '3.5', '4', '4.5', '5', '5.5', '6'];
let gradeOccurences = new Array(allGrades.length).fill(0);
const gradeList = grades.map((grade) => grade.grade);
const teacherGrade = await Prisma.grade.findFirst({ where: { testId: parseInt(params.id), user: { isTeacher: true } } });
for (let i = 0; i < gradeList.length; i++) {
gradeOccurences[allGrades.indexOf(gradeList[i].toString())]++;
@@ -31,13 +33,13 @@ export default async function Page({ params }: { params: { id: string } }) {
return (
<div className={'p-4 md:p-12 w-full h-screen bg-black flex flex-col justify-between gap-y-4'}>
<Image src={logo} alt={'Logo'} width={100} height={200} className={'mx-auto w-full md:w-[400px]'} />
{teacherGrade && (
<div className={'flex flex-col gap-y-2'}>
<p className="text-white">Mme Tixhon :</p>
<h2 className={'text-4xl font-bold text-white'}>{teacherGrade.grade}</h2>
</div>
)}
<Image src={logo} alt={'Logo'} width={100} height={200} className={'mx-auto w-full md:w-[400px]'} />
<Chart data={data} />
</div>
);