Skip to content

Commit b773945

Browse files
authored
fix: don't prompt if assessments invalid (#144)
1 parent 213b96b commit b773945

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/hooks/actions/useSubmitAssessmentAction.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useIntl } from '@edx/frontend-platform/i18n';
22

33
import { MutationStatus, stepNames } from 'constants/index';
44

5-
import { useOnSubmit } from 'hooks/assessment';
5+
import { useIsAssessmentInvalid, useOnSubmit } from 'hooks/assessment';
66
import { useViewStep } from 'hooks/routing';
77

88
import useConfirmAction from './useConfirmAction';
@@ -21,6 +21,7 @@ const useSubmitAssessmentAction = () => {
2121
? `${formatMessage(viewStepMessages[viewStep])} `
2222
: '';
2323
const confirmAction = useConfirmAction();
24+
const isInvalid = useIsAssessmentInvalid();
2425

2526
const action = {
2627
onClick: onSubmit,
@@ -33,7 +34,10 @@ const useSubmitAssessmentAction = () => {
3334
[MutationStatus.success]: formatMessage(messages.gradeSubmitted),
3435
},
3536
};
36-
if (viewStep === stepNames.studentTraining) {
37+
if (viewStep === stepNames.studentTraining || isInvalid) {
38+
// Don't bother showing the confirm modal if we're doing student training
39+
// or if the assessment is invalid and we're just going to show validation
40+
// errors
3741
return { action };
3842
}
3943
return confirmAction({

0 commit comments

Comments
 (0)