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 gap fill question to accept "0" as the right answer #7273

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

renatho
Copy link
Contributor

@renatho renatho commented Nov 7, 2023

Issue reported in p1699118258790299-slack-CAXUNK9MW

Proposed Changes

  • It fixes an issue with the gap fill question, which wasn't accepting "0" as the right answer.

Testing Instructions

  1. Create a course with a quiz.
  2. Add a gap fill question.
  3. Add "0" as the right answer.
  4. Refresh the editor, and make sure the answer continue there.
  5. Answer the quiz as a student and make sure it works properly.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@renatho renatho self-assigned this Nov 7, 2023
@renatho renatho requested a review from a team November 7, 2023 19:22
@renatho renatho changed the title Fix gap fill question to accept "0" as answer Fix gap fill question to accept "0" as the right answer Nov 7, 2023
@renatho renatho added this to the 4.19.2 milestone Nov 7, 2023
@renatho renatho marked this pull request as ready for review November 7, 2023 19:23
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #7273 (300d85f) into trunk (61fefe5) will increase coverage by 0.01%.
Report is 11 commits behind head on trunk.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##              trunk    #7273      +/-   ##
============================================
+ Coverage     50.59%   50.60%   +0.01%     
- Complexity    10975    10976       +1     
============================================
  Files           608      608              
  Lines         46286    46286              
  Branches        402      402              
============================================
+ Hits          23417    23422       +5     
+ Misses        22542    22537       -5     
  Partials        327      327              
Files Coverage Δ
...des/cli/class-sensei-validate-progress-command.php 0.00% <ø> (ø)
...igration/validations/class-progress-validation.php 85.34% <ø> (ø)
...l/migration/validations/class-validation-error.php 100.00% <ø> (ø)
...i/class-sensei-rest-api-question-helpers-trait.php 92.78% <100.00%> (+0.80%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96012db...300d85f. Read the comment docs.

m1r0
m1r0 previously approved these changes Nov 7, 2023
Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

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

Works as described. 💯

I would love to see some tests, but it looks like a tricky thing to do on that piece of code. I will leave that decision up to you. Approving either way.

@renatho
Copy link
Contributor Author

renatho commented Nov 7, 2023

I would love to see some tests, but it looks like a tricky thing to do on that piece of code. I will leave that decision up to you. Approving either way.

Good point, @m1r0! Previously I had searched for tests of that trait class, and I skipped thinking that it would be complex. But after your comment, I checked a little more, and I found the tests of the class using that, so I added the tests there 300d85f. Thank you for the suggestion!

@renatho renatho force-pushed the fix/gap-fill-question-with-answer-0 branch from 3852d04 to 300d85f Compare November 7, 2023 21:35
@renatho renatho requested a review from m1r0 November 7, 2023 21:35
@m1r0
Copy link
Member

m1r0 commented Nov 7, 2023

Nice! That was fast! ⚡

@renatho renatho merged commit 3bb97ab into trunk Nov 7, 2023
24 checks passed
@renatho renatho deleted the fix/gap-fill-question-with-answer-0 branch November 7, 2023 21:46
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.

None yet

2 participants