Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add grading strategy field in problem editor #2

Closed
wants to merge 9 commits into from

Conversation

BryanttV
Copy link

@BryanttV BryanttV commented Nov 8, 2023

Description

This PR adds a new field in the Problem Editor for choosing a Grading Strategy. Currently, the only Grading Strategy is the Last Score. From now on, the new grading strategies are:

  1. Last Score (Default): The last score made is taken for grading.
  2. First Score: The first score made is taken for grading.
  3. Highest Score: The highest score made is taken for grading.
  4. Average Score: The average of all scores made is taken for grading.

Screenshots

image
image
image

Dependencies

This PR needs the changes made from this PR, which includes the new field from the Backend.

Testing Instructions

Using tutor you can test these changes:

  1. In your tutor environment clone the frontend-app-course-authoring MFE

  2. Create a mount with tutor mounts add frontend-app-course-authoring

  3. Run tutor config save and tutor dev start -d

  4. Inside the frontend-app-course-authoring folder clone this repository and checkout to this branch.

  5. Inside the frontend-app-course-authoring folder create a new file called module.config.js with this content:

    module.exports = {
      localModules: [
        {
          moduleName: "@edx/frontend-lib-content-components/dist",
          dir: "./frontend-lib-content-components",
          dist: "src",
        },
        {
          moduleName: "@edx/frontend-lib-content-components",
          dir: "./frontend-lib-content-components",
          dist: "src",
        },
      ],
    };
  6. Then run npm install. First in frontend-lib-content-components, then in frontend-app-course-authoring.

  7. Active in the Django admin (admin/waffle/flag/) this waffle flags: new_core_editors.use_new_problem_editor and new_core_editors.use_new_text_editor like this:

    image

  8. Go to Studio and create a new component with a problem, for example: Single select

  9. In the settings of the component you should see the new field.

@BryanttV BryanttV marked this pull request as ready for review November 17, 2023 13:58
@@ -38,6 +38,8 @@ export const parseScoringSettings = (metadata, defaultSettings) => {

scoring = popuplateItem(scoring, 'weight', 'weight', metadata);

scoring = popuplateItem(scoring, 'grading_strategy', 'gradingStrategy', metadata);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be covered in SettingsParser.test.js

@@ -82,6 +82,16 @@ const messages = defineMessages({
defaultMessage: 'Points',
description: 'Scoring weight input label',
},
scoringGradingStrategyInputLabel: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two messages need to be covered in index.test.jsx

@@ -117,6 +127,11 @@ const messages = defineMessages({
defaultMessage: 'If a value is not set, the problem is worth one point',
description: 'Summary text for scoring weight',
},
gradingStrategyHint: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

className="scoringCard"
>
<div className="mb-4">
<FormattedMessage {...messages.scoringSettingsLabel} />
</div>
<Form.Group>
<Form.Control
Copy link

@johnvente johnvente Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This select needs to be covered in ScordingCard.test.jsx

floatingLabel={intl.formatMessage(messages.scoringGradingStrategyInputLabel)}
>
{Object.values(GradingStrategyKeys).map((gradingStrategy) => {
let optionDisplayName = GradingStrategy[gradingStrategy];
Copy link

@johnvente johnvente Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let optionDisplayName = GradingStrategy[gradingStrategy];
const { defaultMessage } = GradingStrategy[gradingStrategy];
const optionDisplayName = {
...GradingStrategy[gradingStrategy],
defaultMessage: gradingStrategy === defaultValue ? `${defaultMessage} (Default)` : defaultMessage
};

@BryanttV BryanttV force-pushed the bav/add-grading-strategy-field branch 4 times, most recently from d035480 to 5045fb5 Compare December 12, 2023 21:34
@BryanttV BryanttV force-pushed the bav/add-grading-strategy-field branch from 5045fb5 to f61d254 Compare February 19, 2024 16:07
@BryanttV BryanttV closed this Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants