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

fix: default display of "Show Answer" and "Show reset option" #403

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

DmytroAlipov
Copy link
Contributor

@DmytroAlipov DmytroAlipov commented Oct 7, 2023

Description:

I created the issue.
Hardcoding values for showAnswer and showResetButton in initialState leads to incorrect selection of additional states specified in Advanced settings.

Advanced Settings:

2

Editor Page:

1

But the inscription Default is correctly attributed:

3

If you save without changing anything, the value of the Show answer field for the course will be set to Finished(although the default is “closed”, we didn’t change anything in the selection). And this problem is not only with this field. The same behavior for the Show reset option field.

The problem is that the state is being used (frontend-lib-content-components/src/editors/data/redux/problem/reducers.js):

const initialState = {
  rawOLX: '',
  problemType: null,
  question: '',
  answers: [],
  correctAnswerCount: 0,
  groupFeedbackList: [],
  generalFeedback: '',
  additionalAttributes: {},
  defaultSettings: {},
  settings: {
    randomization: null,
    scoring: {
      weight: 1,
      attempts: {
        unlimited: true,
        number: '',
      },
    },
    hints: [],
    timeBetween: 0,
    showAnswer: {
      on: ShowAnswerTypesKeys.FINISHED,
      afterAttempts: 0,
    },
    showResetButton: false,
    solutionExplanation: '',
    tolerance: {
      value: null,
      type: ToleranceTypes.none.type,
    },
  },
};

For Show reset option:

5

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 7, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 7, 2023

Thanks for the pull request, @DmytroAlipov! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@DmytroAlipov DmytroAlipov force-pushed the fix-show-answer-option branch from b12cc88 to ea37da9 Compare October 9, 2023 09:03
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Oct 10, 2023
@e0d
Copy link

e0d commented Oct 10, 2023

@DmytroAlipov seeing some linting failures.

@e0d e0d added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs test run Author's first PR to this repository, awaiting test authorization from Axim labels Oct 10, 2023
@DmytroAlipov DmytroAlipov force-pushed the fix-show-answer-option branch from ea37da9 to 0cf586c Compare October 16, 2023 06:24
@DmytroAlipov
Copy link
Contributor Author

@e0d I have fixed the linting issues. Although my changes only addressed one error, the other errors were related to the code written before me. It's strange that the checks passed previously.

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (60439d5) 90.50% compared to head (3f8e6e3) 90.51%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #403   +/-   ##
=======================================
  Coverage   90.50%   90.51%           
=======================================
  Files         227      227           
  Lines        4108     4110    +2     
  Branches      823      825    +2     
=======================================
+ Hits         3718     3720    +2     
  Misses        369      369           
  Partials       21       21           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mphilbrick211 mphilbrick211 requested a review from a team October 24, 2023 19:29
@mphilbrick211
Copy link

Hi @openedx/teaching-and-learning! This is ready for review :)

@mphilbrick211 mphilbrick211 added waiting for eng review PR is ready for review. Review and merge it, or suggest changes. and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Oct 24, 2023
@KristinAoki
Copy link
Member

@DmytroAlipov Can you resolve the branch conflicts so I can merge the PR?

Hardcoding values for showAnswer and showResetButton
in initialState leads to incorrect selection of additional
states specified in Advanced settings.
@DmytroAlipov DmytroAlipov force-pushed the fix-show-answer-option branch from 0cf586c to 3f8e6e3 Compare December 1, 2023 07:37
@DmytroAlipov
Copy link
Contributor Author

@KristinAoki done 😉

@KristinAoki KristinAoki merged commit ed051c3 into openedx:main Dec 1, 2023
6 checks passed
@openedx-webhooks
Copy link

@DmytroAlipov 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U waiting for eng review PR is ready for review. Review and merge it, or suggest changes.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

The 'Show Answer' option in Advanced settings doesn't affect the 'Show Answer' option for a specific Unit.
5 participants