Skip to content

Grading page: hide rows for lessons with nothing to grade #7926

@donnapep

Description

@donnapep

Problem

The Grading page shows rows for lessons where there is nothing to grade. This includes:

  1. Lessons whose quiz has no questions. These rows show misleading statuses (e.g. "Passed" with a "Review Grade" button that opens an empty quiz) and inflate the Graded count.
  2. Lessons where the student never submitted the quiz. There are no answers to review or grade.

This affects both comments-based and tables-based (HPPS) storage.

Expected behavior

Rows should only appear on the Grading page when:

  • The student has actually submitted the quiz (quiz answers / submission exists), OR
  • There is otherwise something meaningful to review.

Important edge case

If a quiz had questions at one point and a student submitted answers, but the questions were later removed, the submission data still exists and the "Review Grade" page can still show the historical answers. These rows should NOT be excluded — there is still something to review. The filtering should be based on whether a submission/answers exist, not on the current question count alone.

Context

  • Every lesson in Sensei auto-creates a quiz post, so checking for _lesson_quiz meta is not sufficient to determine if a quiz is "real."
  • The migration from comments to tables creates quiz progress rows with passed status for completed lessons even when the quiz has no questions, leading to phantom graded rows.
  • For tables-based storage, quiz submissions can be checked via the wp_sensei_lms_quiz_submissions table. For comments-based storage, the equivalent is the quiz_answers comment meta.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions