Quick fix to solve a problem related to timezone regarding the assignments
This commit is contained in:
@@ -40,11 +40,7 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res, query}) =
|
||||
const exams = await getExamsByIds(uniqBy(assignment.exams, "id"))
|
||||
const session = await getSessionByAssignment(assignmentID)
|
||||
|
||||
if (
|
||||
filterBy(assignment.results, 'user', user.id).length > 0 ||
|
||||
moment(assignment.startDate).isAfter(moment()) ||
|
||||
moment(assignment.endDate).isBefore(moment())
|
||||
)
|
||||
if (filterBy(assignment.results, 'user', user.id).length > 0)
|
||||
return redirect("/exam")
|
||||
|
||||
return {
|
||||
@@ -71,6 +67,8 @@ export default function Page({user, assignment, exams = [], session}: Props) {
|
||||
|
||||
useEffect(() => {
|
||||
if (assignment && exams.length > 0 && !state.assignment && !session) {
|
||||
if (moment(assignment.startDate).isAfter(moment()) || moment(assignment.endDate).isBefore(moment())) return
|
||||
|
||||
state.setUserSolutions([]);
|
||||
state.setShowSolutions(false);
|
||||
state.setAssignment(assignment);
|
||||
|
||||
Reference in New Issue
Block a user