openedx / frontend-lib-content-components

[Moved to openedx/frontend-app-course-authoring] A library of high-level components for content handling (viewing, editing, etc. of HTML, video, problems, etc.), to be shared by multiple MFEs.
GNU Affero General Public License v3.0
11 stars 33 forks source link

Unlimited attempts cannot be updated in problem editor #480

Closed mariajgrimaldi closed 5 months ago

mariajgrimaldi commented 5 months ago

Expected behavior

As a course author, I want to set up a problem with unlimited attempts, so that students can submit their answers as many times as they want.

Actual behavior

As a course author, I cannot assign a problem with unlimited attempts. It happens when you already have a set number of attempts and want to change to unlimited attempts.

Steps to reproduce

  1. From Studio create a problem.
  2. Configure the problem with a number of attempts, e.g.: 5, and save.
  3. Edit the problem try to assign unlimited attempts, and save
  4. The problem continues to have the same number of attempts assigned previously

https://github.com/openedx/wg-build-test-release/assets/64033729/f722b3a2-ed43-4081-ac13-dd84c7008291

Additional information

It happens in all problems, but it does not happen with the legacy editor.

Original issue: https://github.com/openedx/wg-build-test-release/issues/371

mariajgrimaldi commented 5 months ago

See https://github.com/openedx/wg-build-test-release/issues/371#issuecomment-2141200372 for extra debugging details. Thanks!

mariajgrimaldi commented 5 months ago

FYI @arbrandes @brian-smith-tcril @openedx/2u-tnl, please tag anyone who can help.

brian-smith-tcril commented 5 months ago

in some quick testing on the sandbox using the network tab in the browser inspector (filtering to method:POST) I was able to find that checking "unlimited attempts" sends nothing for max_attempts in the metadata part of the payload. By manually entering 0 for number of attempts I was able to get the "You have used 0 of x attempts" message to go away.

mariajgrimaldi commented 5 months ago

@brian-smith-tcril: Exactly, thanks for testing it out! I mentioned something similar in the comment I left here. However, I'm not sure why setting unlimited attempts first works sending the correct metadata but not changing it to unlimited.

EDIT: Oh, I just realized it works because that's the default.

brian-smith-tcril commented 5 months ago

I believe it defaults to zero if no max_attempts value is submitted when creating the problem, but not sending a value for max_attempts when editing is interpreted as "don't change the value for max_attempts"

mariajgrimaldi commented 5 months ago

@brian-smith-tcril right! Thank you :))

mariajgrimaldi commented 5 months ago

I was testing around in the quince sandbox and I couldn't reproduce the error there: image See how the max_attempts is set to "" when selecting unlimited attempts, as Brian mentioned. In case this helps :)

mariajgrimaldi commented 5 months ago

@KristinAoki thank you so much for taking care of this! I have a question, though: how can we backport this to the redwood release?

FYI @brian-smith-tcril

KristinAoki commented 5 months ago

@mariajgrimaldi The change was included in https://github.com/openedx/frontend-app-course-authoring/pull/1071 which upgrades the npm pack for course authoring. I think that the upgrade PR might needs to be backported, but not 100% sure.

mariajgrimaldi commented 5 months ago

@KristinAoki: I created the backport, I hope that's enough! https://github.com/openedx/frontend-app-course-authoring/pull/1075