Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX - [Numeric Input] - Check for wrong answers when scoring (#1743)
## Summary: On occasion, answer options within the Numeric Input can overlap. In cases where the wrong/ungraded answer comes before the correct answer, it is important to honor this order when validating a learner's answer. Currently, the Numeric Input widget checks all correct answers for a match before looking at the remaining answer options. This means that an incorrect answer would be marked as correct. This bugfix changes the validation logic to look for the first match regardless of the correctness of the answer itself, and then reports the validation based upon the match. Issue: LEMS-2238 ## Test plan: **No Storybook option exists for testing validation of a widget - [must be tested in a ZND](https://prod-znd-241016-markfitz-m01.khanacademy.org)** 1. Open a Test Everything exercise ([Numeric Input](https://prod-znd-241016-markfitz-m01.khanacademy.org/internal-courses/test-everything/test-everything-2-without-mastery/te-numeric-input/e/numeric-input-exercise) may be helpful) * Make sure to be logged in 1. Edit the exercise ![Click to edit](https://github.com/user-attachments/assets/59fa66dc-3cd2-45f1-8f5a-ab470997cf93) 1. Add a new item to the exercise ![Click to add](https://github.com/user-attachments/assets/f4e3f096-6ea0-4258-bcba-679783d671a6) 1. Add a Numeric Input widget to the item ![Add widget](https://github.com/user-attachments/assets/6359fd1a-c48c-44f9-b1b4-f42327b87be6) 1. Enter an answer of "4" and mark it wrong by clicking on the green "correct" indicator ![Add wrong answer](https://github.com/user-attachments/assets/2d1cd161-da8a-44c4-898a-8193d01fe1da) 1. Add another answer ![Add new answer](https://github.com/user-attachments/assets/abfdd21e-2d59-40df-bfaa-2b2e8680310f) 1. Enter an answer of "10 +/- 10" ![Add correct answer](https://github.com/user-attachments/assets/20ebda59-e066-4e6b-a3a6-b1e4ff8407e5) 1. Test the widget in "Preview" ![Test widget](https://github.com/user-attachments/assets/06f91487-1edd-41fe-ab1c-b43911c5d17b) * Enter the number "4" and click "Check" button - button text should change to "Try again" * Enter a different number (like "5") and click the "Check"/"Try again" button - confetti and button text changes to "Done" Author: mark-fitzgerald Reviewers: SonicScrewdriver Required Reviewers: Approved By: SonicScrewdriver Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1743
- Loading branch information