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 auto grading not working on the Grading page for multiple choice questions #6884

Merged
merged 2 commits into from
May 23, 2023

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented May 16, 2023

Resolves #6529.

Proposed Changes

I'm unsure of why it started happening now (or maybe it's been an issue for a long time and we just didn't receive reports before now?), but the check to see if user_answers is the same length as correct_answers always failed. This is because, when splitting correct_answers, there's an empty element appended to the array ((2) ['True', '']), so the check would fail and the question would be marked incorrect.

Testing Instructions

  1. Add 3 multiple choice questions to a lesson. Ensure that Auto Grade is disabled for the quiz.
  2. As a student, take the quiz.
  3. In Grading, find the quiz and click Grade quiz.
  4. Click the Auto grade button.

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

@donnapep donnapep self-assigned this May 16, 2023
@github-actions
Copy link

github-actions bot commented May 16, 2023

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 93ad69a and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
js/grading-general.js 2.66 kB +4 B ( +0.16% 🔼 )

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

@donnapep donnapep added this to the 4.15.0 milestone May 16, 2023
@donnapep donnapep requested a review from a team May 16, 2023 15:07
@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Merging #6884 (93ad69a) into trunk (47552bb) will increase coverage by 0.00%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff            @@
##              trunk    #6884   +/-   ##
=========================================
  Coverage     46.88%   46.88%           
- Complexity    10189    10190    +1     
=========================================
  Files           554      554           
  Lines         36751    36751           
  Branches        381      381           
=========================================
+ Hits          17229    17230    +1     
+ Misses        19216    19215    -1     
  Partials        306      306           
Impacted Files Coverage Δ
includes/class-sensei-preview-user.php 82.20% <57.14%> (-0.11%) ⬇️
includes/class-sensei-guest-user.php 88.23% <75.00%> (-0.10%) ⬇️
includes/class-sensei-temporary-user.php 86.20% <100.00%> (+0.32%) ⬆️
includes/mailpoet/class-main.php 66.92% <100.00%> (ø)

... and 1 file with indirect coverage changes


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 0fa020d...93ad69a. Read the comment docs.

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.

It's working! 🎉

I've noticed that it still breaks when using a multiple choice question with multiple correct answers but I will try to fix it in a separate PR.

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.

Manual quiz AutoGrade not working
2 participants