Sensei: Lessons in a removed module do not appear on Course page

Created on 26 Apr 2018  路  2Comments  路  Source: Automattic/sensei

Steps to Reproduce

  1. Create a course with at least one module.
  2. Add lessons to the course, with at least one in a module, and at least one that is in no module.
  3. Load the course page on the frontend. All lessons should be visible, grouped by module, with a group of "Other Lessons" showing the lesson(s) in no module.
  4. On the course page in WP Admin, remove the module from the course.
  5. Reload the course page on the frontend. The lessons in the removed module do not appear.

This is similar to https://github.com/woocommerce/sensei-course-progress/issues/43 (also see https://github.com/woocommerce/sensei-course-progress/pull/50).

What I Expected

Since the lessons were not removed from the course, they should be shown in the "Other Lessons" section.

What Happened Instead

The lessons were not displayed, as if they had been removed from the course.

Other information

The query for the courses with no module is done here, and it appears to be trying to load all lessons belonging to the course, but not belonging to any module of the course. I believe this is the correct logic, but there may be another reason why the query is failing.

Since there was the similar issue above in the Course Progress Widget, it makes me think that we should create helper functions to do queries like this, so extensions don't have to do the queries manually.

Courses [Pri] Normal [Status] Accepted [Type] Bug

Most helpful comment

Since there was the similar issue above in the Course Progress Widget, it makes me think that we should create helper functions to do queries like this, so extensions don't have to do the queries manually.

Agreed. @jom did a similar thing here.

All 2 comments

Interestingly, the lessons do appear under _Other Lessons_ on the _Lessons_ > _Order Lessons_ screen.
^ Actually, not if there are no modules in a course; only if some.

Since there was the similar issue above in the Course Progress Widget, it makes me think that we should create helper functions to do queries like this, so extensions don't have to do the queries manually.

Agreed. @jom did a similar thing here.

Was this page helpful?
0 / 5 - 0 ratings