oppia: [BUG]: TODO(wxy): Validate that inputs.a <= inputs.b.
Describe the bug
The HasLengthInclusivelyBetween method currently does not perform any validation on the inputs, potentially leading to incorrect behavior if inputs.a is greater than inputs.b. The TODO comment indicates the need to validate that inputs.a is less than or equal to inputs.b.
This issue aims to add the necessary validation logic to ensure the inputs are correctly validated before processing.
Code location: extensions/interactions/MusicNotesInput/directives/music-notes-input-rules.service.ts
URL of the page where the issue is observed.
No response
Steps To Reproduce
- Open the file containing the
MusicNotesInputRulesServiceclass. - Locate the
HasLengthInclusivelyBetweenmethod and its TODO comment.
Expected Behavior
The HasLengthInclusivelyBetween method should validate that inputs.a is less than or equal to inputs.b before proceeding with the length check. If the validation fails, the method should handle the error appropriately, either by returning false or throwing an error.
Screenshots/Videos
No response
What device are you using?
No response
Operating System
No response
What browsers are you seeing the problem on?
No response
Browser version
No response
Additional context
- Ensure that the rest of the method executes only if the validation passes.
- Ensure that the validation logic covers all possible edge cases to prevent invalid configurations.
Tips for developers
Before addressing the bug, please identify which PR caused the issue (you can follow the steps here). If you identify the PR, comment on the issue with a link to it. If not, mention the commit hash of the oldest commit you saw the bug on (and the month and year it was made in).
Then, please leave a comment with details of the approach that you plan to take to fix the issue (see example).
Note: If this is your first Oppia issue, please make sure to follow our guidelines for choosing an issue and setting things up. You will also need to show a demo of the fix working correctly on your local machine. Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (19 by maintainers)
Commits related to this issue
- Fix #20443: Added validation check for the range in the HasLengthInclusivelyBetween method (#20977) * Added a validation check for the range in the HasLengthInclusivelyBetween method * Added a test ... — committed to oppia/oppia by sonu4578 2 years ago
- Revert "Fix #20443: Added validation check for the range in the HasLengthIncl…" This reverts commit d221cfc7603e200494aec4b200c3230a86bf2ae5. — committed to oppia/oppia by seanlip 2 years ago
- Revert "Fix #20443: Added validation check for the range in the HasLengthInclusivelyBetween method" (#21131) Revert "Fix #20443: Added validation check for the range in the HasLengthIncl…" This re... — committed to alicesturefors/oppia by seanlip 2 years ago
- Revert "Fix #20443: Added validation check for the range in the HasLengthInclusivelyBetween method" (#21131) Revert "Fix #20443: Added validation check for the range in the HasLengthIncl…" This re... — committed to imchristie/oppia by seanlip 2 years ago
- Fix #20011: Migrate Acceptance Test to Jest and Add Screenshot Testing (#20945) * Added test for i18n format * Question Admin * Added Functions for Question Admin * Added Functions for Question Ad... — committed to oppia/oppia by imchristie 2 years ago
- Fix #20443: Created validation that a<b when creating an interaction with HasLengthInclusivelyBetween (#21211) * Fix validation that a<b when creating an interaction with HasLengthInclusivelyBetween ... — committed to oppia/oppia by Ludvigsta 2 years ago
- Fix #20443: Created validation that a<b when creating an interaction with HasLengthInclusivelyBetween (#21211) * Fix validation that a<b when creating an interaction with HasLengthInclusivelyBetween ... — committed to mon4our/oppia by Ludvigsta 2 years ago
@HardikGoyal2003 Thank you Hardik, I have run the front end tests and attached a screenshot of the successful tests in this PR: https://github.com/oppia/oppia/pull/20977
Hey @sonu4578 Solution looks good!! Assigning the issue to you!!