diff --git a/src/Constants/Options.ts b/src/Constants/Options.ts
index cd812a8..b7f0e19 100644
--- a/src/Constants/Options.ts
+++ b/src/Constants/Options.ts
@@ -1,4 +1,4 @@
-import { AuthType, Grades, Option, Platform, Subjects } from '@/types';
+import { AuthType, Grades, MARKING_SCHEMES, Option, Platform, Subjects } from '@/types';
export const TestTypeOptions: Option[] = [
{ value: 'assessment', label: 'Assessment' },
@@ -41,10 +41,10 @@ export const TestPlatformOptions = Object.values(Platform).map((value) => ({
label: value.toString(),
}));
-export const MarkingSchemeOptions: Option[] = [
- { value: '4,-1', label: '4,-1' },
- { value: '1,0', label: '1,0' },
-];
+export const MarkingSchemeOptions: Option[] = Object.values(MARKING_SCHEMES).map((value) => ({
+ value: value.toString(),
+ label: value.toString(),
+}));
export const OptionalLimitOptions: Option[] = [
{ value: 'N/A', label: 'N/A' },
diff --git a/src/app/(home)/ModalData.ts b/src/app/(home)/ModalData.ts
index e407a64..f9f7264 100644
--- a/src/app/(home)/ModalData.ts
+++ b/src/app/(home)/ModalData.ts
@@ -86,7 +86,7 @@ export const displayData = (data: Session, formOptions: Option[]) => {
value: data.meta_data?.shortened_link
? absoluteLink(data.meta_data?.shortened_link)
: 'N/A',
- isLink: !!data.portal_link,
+ isLink: !!data.meta_data?.shortened_link,
},
{
label: 'Admin Link',
diff --git a/src/app/(home)/Table/Actions.tsx b/src/app/(home)/Table/Actions.tsx
index a08c1b8..e64bfca 100644
--- a/src/app/(home)/Table/Actions.tsx
+++ b/src/app/(home)/Table/Actions.tsx
@@ -93,7 +93,6 @@ const LinkAction = ({ value, pending }: { value: string; pending: boolean }) =>
>
-
);
};
diff --git a/src/app/session/[type]/Steps/Platform/Quiz.tsx b/src/app/session/[type]/Steps/Platform/Quiz.tsx
index 65ab2b1..1e95b43 100644
--- a/src/app/session/[type]/Steps/Platform/Quiz.tsx
+++ b/src/app/session/[type]/Steps/Platform/Quiz.tsx
@@ -13,6 +13,7 @@ import { FormBuilder } from '@/components/FormBuilder';
import { useFormContext } from '@/hooks/useFormContext';
import {
FieldSchema,
+ MARKING_SCHEMES,
Session,
SessionParams,
SessionType,
@@ -72,6 +73,7 @@ const QuizForm: FC = () => {
placeholder: 'Select a marking scheme',
label: 'Marking Scheme',
disabled: type === SessionType.EDIT,
+ hide: true,
},
optionalLimit: {
type: 'select',
@@ -104,6 +106,8 @@ const QuizForm: FC = () => {
);
const onSubmit = useCallback((data: quizFields) => {
+ const isHomework = data.testType === 'homework';
+
const addedData: Session = {
meta_data: {
course: data.course,
@@ -111,7 +115,7 @@ const QuizForm: FC = () => {
test_format: data.testFormat,
test_purpose: data.testPurpose,
test_type: data.testType,
- marking_scheme: data.markingScheme,
+ marking_scheme: isHomework ? MARKING_SCHEMES['1, 0'] : MARKING_SCHEMES['4,-1'],
optional_limits: data.optionalLimit,
cms_test_id: data.cmsUrl,
show_answers: data.showAnswers,
diff --git a/src/types/enums.ts b/src/types/enums.ts
index fdff1d5..a7fe236 100644
--- a/src/types/enums.ts
+++ b/src/types/enums.ts
@@ -84,3 +84,8 @@ export enum Subjects {
}
export const Grades = [9, 10, 11, 12, 13] as const;
+
+export const MARKING_SCHEMES = {
+ '4,-1': '4,-1',
+ '1, 0': '1, 0',
+} as const;
diff --git a/src/types/form.types.ts b/src/types/form.types.ts
index b25da4a..3232f64 100644
--- a/src/types/form.types.ts
+++ b/src/types/form.types.ts
@@ -145,12 +145,7 @@ export const quizSchema = z.object({
(value) => TestTypeOptions.some((option) => option.value === value),
'Invalid option selected'
),
- markingScheme: z
- .string({ required_error: 'This field is required' })
- .refine(
- (value) => MarkingSchemeOptions.some((option) => option.value === value),
- 'Invalid option selected'
- ),
+ markingScheme: z.string().optional(),
optionalLimit: z
.string({ required_error: 'This field is required' })
.refine(