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

Quiz submission validation CLI command #7251

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

merkushin
Copy link
Member

@merkushin merkushin commented Nov 1, 2023

Resolves #7077

Proposed Changes

  • Add quiz submission validation CLI command.

Testing Instructions

  1. Make sure you have custom tables created. (Remove sensei-version from wp_options if you don't.)
  2. Run wp sensei validate quiz-submission before running migration. It is expected to get a bunch of errors like Tables-based submission not found.
  3. Run migration from Sensei LMS > Tools
    If it is not the first run, delete two options:
DELETE FROM wp_options where option_name = 'sensei_migrated_progress_last_comment_id';
DELETE FROM wp_options where option_name = 'sensei_migrated_quiz_last_comment_id';
  1. Run wp sensei validate quiz-submission after migration. No errors expected.
  2. Now try to play with data. You can first remove some tables-based submissions, grades, and answers. After running the tool it is expected to see corresponding errors.
  3. Now do the same with comments-based submissions, grades, and answers.

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

@merkushin merkushin added this to the 4.20.0 milestone Nov 1, 2023
@merkushin merkushin requested a review from a team November 1, 2023 05:11
@merkushin merkushin self-assigned this Nov 1, 2023
Copy link

github-actions bot commented Nov 1, 2023

WordPress Dependencies Report

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

No changes detected in the current commit. But the comment was left so it is possible to check for the edit history.

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

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #7251 (70e315d) into trunk (f93f87f) will increase coverage by 0.20%.
Report is 139 commits behind head on trunk.
The diff coverage is 76.83%.

Impacted file tree graph

@@             Coverage Diff              @@
##              trunk    #7251      +/-   ##
============================================
+ Coverage     50.53%   50.74%   +0.20%     
- Complexity    10932    11020      +88     
============================================
  Files           607      610       +3     
  Lines         46149    46544     +395     
  Branches        402      402              
============================================
+ Hits          23322    23619     +297     
- Misses        22500    22598      +98     
  Partials        327      327              
Files Coverage Δ
includes/class-sensei-cli.php 0.00% <0.00%> (ø)
...des/cli/class-sensei-validate-progress-command.php 0.00% <0.00%> (ø)
.../class-sensei-validate-quiz-submission-command.php 0.00% <0.00%> (ø)
...n/validations/class-quiz-submission-validation.php 84.32% <84.32%> (ø)

... and 10 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 f93f87f...70e315d. Read the comment docs.

Base automatically changed from add/progress-validation-cli to trunk November 6, 2023 11:33
@merkushin merkushin force-pushed the add/quiz-submission-validation-cli branch from 3572a51 to c148365 Compare November 7, 2023 06:50
@merkushin merkushin force-pushed the add/quiz-submission-validation-cli branch from c148365 to 70e315d Compare November 7, 2023 06:55
@merkushin merkushin marked this pull request as ready for review November 7, 2023 13:57
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 works great! 💯

I've noticed some small code duplication between the validation classes but there is not much logic in that code so I think it's ok. 👍

@merkushin merkushin merged commit c7a8423 into trunk Nov 8, 2023
23 checks passed
@merkushin merkushin deleted the add/quiz-submission-validation-cli branch November 8, 2023 19:27
@donnapep donnapep modified the milestones: 4.20.0, 4.19.2 Nov 9, 2023
@m1r0 m1r0 added the HPPS label Nov 9, 2023
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.

Make a CLI command for validating the migrated quiz data
3 participants