Skip to content

Commit

Permalink
[ENHANCEMENT] [MER-3705] allow manual grading on multi-input text/num…
Browse files Browse the repository at this point in the history
…eric parts (Simon-Initiative#5062)

Co-authored-by: Anders Weinstein <[email protected]>
  • Loading branch information
andersweinstein and Anders Weinstein authored Aug 28, 2024
1 parent e3df04a commit 6a9f03b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { useAuthoringElementContext } from 'components/activities/AuthoringElementProvider';
import { AuthoringButtonConnected } from 'components/activities/common/authoring/AuthoringButton';
import { GradingApproachDropdown } from 'components/activities/common/authoring/GradingApproachDropdown';
import { MCActions } from 'components/activities/common/authoring/actions/multipleChoiceActions';
import { usesCustomScoring } from 'components/activities/common/authoring/actions/scoringActions';
import { ChoicesDelivery } from 'components/activities/common/choices/delivery/ChoicesDelivery';
Expand All @@ -17,12 +18,14 @@ import {
MultiInputSchema,
} from 'components/activities/multi_input/schema';
import { getCorrectChoice } from 'components/activities/multiple_choice/utils';
import { ShortAnswerActions } from 'components/activities/short_answer/actions';
import { InputEntry } from 'components/activities/short_answer/sections/InputEntry';
import { getTargetedResponses } from 'components/activities/short_answer/utils';
import { Response, RichText, makeResponse } from 'components/activities/types';
import { GradingApproach, Response, RichText, makeResponse } from 'components/activities/types';
import { Radio } from 'components/misc/icons/radio/Radio';
import { getCorrectResponse } from 'data/activities/model/responses';
import { containsRule, eqRule, equalsRule } from 'data/activities/model/rules';
import { getPartById } from 'data/activities/model/utils';
import { defaultWriterContext } from 'data/content/writers/context';
import { MultiInputScoringMethod } from '../MultiInputScoringMethod';

Expand Down Expand Up @@ -96,8 +99,19 @@ export const AnswerKeyTab: React.FC<Props> = (props) => {
</>
);
}

// else text/numeric input. Allow manual grading as for short answers
return (
<div className="d-flex flex-column mb-2">
<GradingApproachDropdown
editMode={editMode}
selected={
getPartById(model, props.input.partId)?.gradingApproach || GradingApproach.automatic
}
onChange={(gradingApproach) =>
dispatch(ShortAnswerActions.setGradingApproach(gradingApproach, props.input.partId))
}
/>
<InputEntry
key={getCorrectResponse(model, props.input.partId).id}
inputType={props.input.inputType}
Expand Down
4 changes: 2 additions & 2 deletions assets/src/components/activities/short_answer/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Responses } from 'data/activities/model/responses';
import { getPartById } from 'data/activities/model/utils';
import { GradingApproach } from '../types';
import { GradingApproach, HasParts } from '../types';
import { InputType, ShortAnswerModelSchema } from './schema';

export const ShortAnswerActions = {
Expand All @@ -20,7 +20,7 @@ export const ShortAnswerActions = {
};
},
setGradingApproach(gradingApproach: GradingApproach, partId: string) {
return (model: ShortAnswerModelSchema) => {
return (model: HasParts) => {
getPartById(model, partId).gradingApproach = gradingApproach;
};
},
Expand Down

0 comments on commit 6a9f03b

Please sign in to comment.