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

Split the quiz answer model #7178

Merged
merged 5 commits into from
Sep 21, 2023
Merged

Split the quiz answer model #7178

merged 5 commits into from
Sep 21, 2023

Conversation

m1r0
Copy link
Member

@m1r0 m1r0 commented Sep 19, 2023

Part of #7159

Proposed Changes

  • Split the quiz answer model into comments-based and tables-based models.

Testing Instructions

  1. Test that the quiz answers are stored correctly when tables-based progress is disabled.
  2. Test that the quiz answers are stored correctly when tables-based progress is enabled.

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

@m1r0 m1r0 self-assigned this Sep 19, 2023
@m1r0 m1r0 added this to the 4.17.1 milestone Sep 19, 2023
@m1r0 m1r0 requested a review from a team September 19, 2023 19:29
@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #7178 (2ce417e) into trunk (ef6cee6) will increase coverage by 0.00%.
Report is 38 commits behind head on trunk.
The diff coverage is 79.41%.

Impacted file tree graph

@@            Coverage Diff            @@
##              trunk    #7178   +/-   ##
=========================================
  Coverage     49.80%   49.80%           
- Complexity    10650    10656    +6     
=========================================
  Files           586      589    +3     
  Lines         45047    45067   +20     
  Branches        402      402           
=========================================
+ Hits          22434    22445   +11     
- Misses        22286    22295    +9     
  Partials        327      327           
Files Changed Coverage Δ
includes/admin/class-sensei-learners-main.php 5.30% <0.00%> (ø)
...submission/answer/models/class-answer-abstract.php 66.66% <ø> (ø)
...ubmission/answer/models/class-answer-interface.php 50.00% <50.00%> (ø)
...ission/answer/models/class-tables-based-answer.php 50.00% <50.00%> (ø)
...sion/answer/models/class-comments-based-answer.php 83.33% <83.33%> (ø)
includes/class-sensei-quiz.php 59.52% <100.00%> (ø)
...repositories/class-aggregate-answer-repository.php 100.00% <100.00%> (ø)
...itories/class-comments-based-answer-repository.php 100.00% <100.00%> (ø)
...ositories/class-tables-based-answer-repository.php 100.00% <100.00%> (ø)
.../repositories/class-aggregate-grade-repository.php 95.14% <100.00%> (ø)
... and 2 more

... and 9 files 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 105592a...2ce417e. Read the comment docs.

* @since $$next_version$$
*/
class Comments_Based_Answer extends Answer_Abstract {

Copy link
Member

Choose a reason for hiding this comment

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

As we don't have an id for this version, what do you think about throwing an exception here?
Also we don't need it in the constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. I've updated it in dc2347f.

I've also updated (73889e3) the Grade_Repository->create method to accept the answer model instance instead of an id. This change fixes the issue of having to check the answer model type and having to pass an ID of 0 if it's a comment type.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @m1r0! Feels better :)

@m1r0 m1r0 merged commit 2e1247c into trunk Sep 21, 2023
@m1r0 m1r0 deleted the update/split-quiz-answer-model branch September 21, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants