diff --git a/src/dashboards/AssignmentCreator.tsx b/src/dashboards/AssignmentCreator.tsx index bc4de1b1..1a0c1958 100644 --- a/src/dashboards/AssignmentCreator.tsx +++ b/src/dashboards/AssignmentCreator.tsx @@ -48,6 +48,7 @@ export default function AssignmentCreator({isCreating, assignment, user, groups, ); const [isLoading, setIsLoading] = useState(false); const [startDate, setStartDate] = useState(assignment ? moment(assignment.startDate).toDate() : new Date()); + const [endDate, setEndDate] = useState( assignment ? moment(assignment.endDate).toDate() : moment().hours(23).minutes(59).add(8, "day").toDate(), ); @@ -57,6 +58,9 @@ export default function AssignmentCreator({isCreating, assignment, user, groups, const [generateMultiple, setGenerateMultiple] = useState(false); const [released, setReleased] = useState(false); + const [autoStart, setAutostart] = useState(false); + const [autoStartDate, setAutoStartDate] = useState(assignment ? moment(assignment.autoStartDate).toDate() : new Date()); + const [useRandomExams, setUseRandomExams] = useState(true); const [examIDs, setExamIDs] = useState<{id: string; module: Module}[]>([]); @@ -90,6 +94,8 @@ export default function AssignmentCreator({isCreating, assignment, user, groups, variant, instructorGender, released, + autoStart, + autoStartDate, }) .then(() => { toast.success(`The assignment "${name}" has been ${assignment ? "updated" : "created"} successfully!`); @@ -233,7 +239,7 @@ export default function AssignmentCreator({isCreating, assignment, user, groups,
- + setEndDate(date)} />
+ {autoStart && (
+ + moment(date).isSameOrAfter(new Date())} + dateFormat="dd/MM/yyyy HH:mm" + selected={autoStartDate} + showTimeSelect + onChange={(date) => setAutoStartDate(date)} + /> +
+ )}
{selectedModules.includes("speaking") && ( @@ -382,6 +405,9 @@ export default function AssignmentCreator({isCreating, assignment, user, groups, setReleased((d) => !d)}> Auto release results + setAutostart((d) => !d)}> + Auto start exam +