Skip to content

Commit

Permalink
Merge branch 'Simon-Initiative:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dtiwarATS authored Dec 10, 2024
2 parents d690cb0 + 100170f commit af57342
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/src/components/activities/common/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { ShortAnswerModelSchema } from '../short_answer/schema';
import {
HasPerPartSubmissionOption,
PartId,
Expand Down Expand Up @@ -35,6 +36,12 @@ export const togglePerPartSubmissionOption = () => {
};
};

export const toggleSubmitAndCompareOption = () => {
return (model: ShortAnswerModelSchema): void => {
model.submitAndCompare = !model.submitAndCompare;
};
};

interface ShuffleChoicesOptionProps {
onShuffle: () => void;
model: { authoring: { transformations: Transformation[] } };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import { defaultWriterContext } from 'data/content/writers/context';
import { configureStore } from 'state/store';
import { AuthoringElement, AuthoringElementProps } from '../AuthoringElement';
import { AuthoringElementProvider, useAuthoringElementContext } from '../AuthoringElementProvider';
import { ActivitySettings } from '../common/authoring/settings/ActivitySettings';
import { Explanation } from '../common/explanation/ExplanationAuthoring';
import { ActivityScoring } from '../common/responses/ActivityScoring';
import { toggleSubmitAndCompareOption } from '../common/utils';
import { VariableEditorOrNot } from '../common/variables/VariableEditorOrNot';
import { VariableActions } from '../common/variables/variableActions';
import { ShortAnswerActions } from './actions';
Expand All @@ -38,6 +40,13 @@ const store = configureStore();
const ShortAnswer = () => {
const { dispatch, model, editMode, projectSlug } =
useAuthoringElementContext<ShortAnswerModelSchema>();

const submitAndCompareSetting = {
label: 'Submit And Compare',
isEnabled: model.submitAndCompare === true,
onToggle: () => dispatch(toggleSubmitAndCompareOption()),
};

return (
<>
<TabbedNavigation.Tabs>
Expand Down Expand Up @@ -167,6 +176,7 @@ const ShortAnswer = () => {
onEdit={(t) => dispatch(VariableActions.onUpdateTransformations(t))}
/>
</TabbedNavigation.Tab>
<ActivitySettings settings={[submitAndCompareSetting]} />
</TabbedNavigation.Tabs>
</>
);
Expand Down

0 comments on commit af57342

Please sign in to comment.