Updated the score to be reflective of the ungraded questions

This commit is contained in:
Tiago Ribeiro
2024-11-19 16:21:08 +00:00
parent bb24fe3c6d
commit e6d77af53f
2 changed files with 38 additions and 37 deletions

View File

@@ -159,7 +159,7 @@ export default function AssignmentView({user, users, entity, assignment}: Props)
}, },
}; };
stats.forEach((x) => { stats.filter(x => !x.isPractice).forEach((x) => {
scores[x.module!] = { scores[x.module!] = {
total: scores[x.module!].total + x.score.total, total: scores[x.module!].total + x.score.total,
correct: scores[x.module!].correct + x.score.correct, correct: scores[x.module!].correct + x.score.correct,

View File

@@ -19,15 +19,16 @@ import { uniqBy } from "lodash";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { getSessionByAssignment, getSessionsByUser } from "@/utils/sessions.be"; import { getSessionByAssignment, getSessionsByUser } from "@/utils/sessions.be";
import { Session } from "@/hooks/useSessions"; import { Session } from "@/hooks/useSessions";
import moment from "moment";
import { activeAssignmentFilter } from "@/utils/assignments"; import { activeAssignmentFilter } from "@/utils/assignments";
import { checkAccess } from "@/utils/permissions";
export const getServerSideProps = withIronSessionSsr(async ({ req, res, query }) => { export const getServerSideProps = withIronSessionSsr(async ({ req, res, query }) => {
const user = await requestUser(req, res) const user = await requestUser(req, res)
const loginDestination = Buffer.from(req.url || "/").toString("base64") const loginDestination = Buffer.from(req.url || "/").toString("base64")
if (!user) return redirect(`/login?destination=${loginDestination}`) if (!user) return redirect(`/login?destination=${loginDestination}`)
if (shouldRedirectHome(user)) return redirect("/") if (shouldRedirectHome(user) || checkAccess(user, ["corporate", "mastercorporate"]))
return redirect("/")
const { assignment: assignmentID, destination } = query as { assignment?: string, destination?: string } const { assignment: assignmentID, destination } = query as { assignment?: string, destination?: string }
const destinationURL = !!destination ? Buffer.from(destination, 'base64').toString() : undefined const destinationURL = !!destination ? Buffer.from(destination, 'base64').toString() : undefined