Summary
The comments-based Lesson_Progress::get_status() checks the quiz's _pass_required setting when the quiz status is failed — if pass is not required, the lesson is still considered complete. The tables-based implementation does not have this check, so a failed quiz always means the lesson is in-progress.
This needs investigation to confirm whether this is a valid discrepancy that should be fixed, or whether the tables-based behavior is intentionally simpler.
Details
Comments-based (Comments_Based_Lesson_Progress::get_status()):
case 'failed':
$pass_required = get_post_meta( $lesson_quiz_id, '_pass_required', true );
if ( empty( $pass_required ) ) {
return self::STATUS_COMPLETE; // Pass not required, so lesson is complete
}
return self::STATUS_IN_PROGRESS;
Tables-based (Tables_Based_Lesson_Progress):
- Empty class, inherits
Lesson_Progress_Abstract::get_status() which returns the raw status
is_complete() checks get_status() === STATUS_COMPLETE
- A failed quiz student has lesson status
in-progress in the tables → is_complete() returns false
Observed impact
On the Reports pages (discovered during PR #7932), this causes several differences between comments and tables storage:
- Date Completed column — comments shows a date for failed students (because
comment_date is always updated), tables shows blank (because completed_at is NULL for non-complete lessons)
- Percent complete — may be lower in tables because failed + pass-not-required students aren't counted as complete
- Completion counts — same as above
Questions to assess
- Is the comments-based
_pass_required check the correct behavior, or is it a legacy workaround?
- Should the tables-based storage set
completed_at and status complete when a quiz is failed but pass is not required?
- If so, should this be handled at the storage layer (
is_complete()) or at the point where quiz results are processed?
- Would fixing this require a data migration for existing sites?
Related
🤖 Generated with Claude Code
Summary
The comments-based
Lesson_Progress::get_status()checks the quiz's_pass_requiredsetting when the quiz status isfailed— if pass is not required, the lesson is still considered complete. The tables-based implementation does not have this check, so a failed quiz always means the lesson isin-progress.This needs investigation to confirm whether this is a valid discrepancy that should be fixed, or whether the tables-based behavior is intentionally simpler.
Details
Comments-based (
Comments_Based_Lesson_Progress::get_status()):Tables-based (
Tables_Based_Lesson_Progress):Lesson_Progress_Abstract::get_status()which returns the raw statusis_complete()checksget_status() === STATUS_COMPLETEin-progressin the tables →is_complete()returns falseObserved impact
On the Reports pages (discovered during PR #7932), this causes several differences between comments and tables storage:
comment_dateis always updated), tables shows blank (becausecompleted_atis NULL for non-complete lessons)Questions to assess
_pass_requiredcheck the correct behavior, or is it a legacy workaround?completed_atand statuscompletewhen a quiz is failed but pass is not required?is_complete()) or at the point where quiz results are processed?Related
🤖 Generated with Claude Code