Repository navigation
Fix/user completed lesson empty lesson quiz - #8240
Open
markcummins wants to merge 2 commits into
Open
markcummins wants to merge 2 commits into
markcummins wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The updated completion behavior is not covered by a regression test for the stale-quiz-progress/no-questions scenario described in the PR.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes an edge-case in lesson completion logic where a stale “in-progress” quiz progress record could cause Sensei_Utils::user_completed_lesson() to return false even after the lesson itself was completed, specifically when the associated quiz no longer has any questions.
Changes:
- Update
Sensei_Utils::user_completed_lesson()to only consult quiz progress (when pass is required) if the lesson’s quiz still has questions. - Add a patch-level changelog entry describing the bug fix.
File summaries
| File | Description |
|---|---|
includes/class-sensei-utils.php |
Avoids using quiz progress to determine completion when the quiz effectively has no questions. |
changelog/fix-user-completed-lesson-empty-quiz |
Documents the fix as a patch “fixed” changelog entry. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // In the tables-based progress we split them. Here is important to use the quiz proress if the quiz pass is required. | ||
| $lesson_quiz_id = Sensei()->lesson->lesson_quizzes( $lesson_id ); | ||
| if ( $lesson_quiz_id ) { | ||
| if ( $lesson_quiz_id && Sensei_Lesson::lesson_quiz_has_questions( $lesson_id ) ) { |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #
Proposed Changes
Screenshots
Testing Instructions
New/Updated Hooks
Deprecated Code
Changelog entry
Changelog Entry Details
Significance
Type
Message
Fix a lesson incorrectly showing as incomplete when its quiz has a stale in-progress attempt but no actual questions.