Skip to content

Private completed lessons prevent user from completing the course #2802

@cleardesign

Description

@cleardesign

Steps to Reproduce

  1. Create a private Course and Lesson with a Quiz
  2. Complete the Quiz with a pass grade
  3. Check Learner Management admin page for that course

What I Expected

As all lessons were completed user should be in Completed status. If Lessons are not private but published status, then all works well. This bug happens only with private lessons status.

What Happened Instead

The course for that user is still "In Progress"

PHP / WordPress / Sensei version

PHP 7.3 / WP 5.2.3 / Sensei 1.12.3

Browser / OS version

Any, this is PHP related issue

Context / Source

I identified the issue to be in the wp-content/plugins/woothemes-sensei/includes/class-sensei-utils.php:1584:
$lesson_ids = Sensei()->course->course_lessons( $course_id, 'publish', 'ids' );
If that line it's replaced with
$lesson_ids = Sensei()->course->course_lessons( $course_id, ['publish', 'private'], 'ids' );
then everything works well.
As you can see that part of the code it's ignoring private lessons so it ends up later when comparing if all lessons were completed in a wrong result.

Issue first reported on WP at: https://wordpress.org/support/topic/analysis-date-completed-field-blank-for-course/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions