Skip to content

Poor theme performance due to calling Sensei get_courses_average_grade(). #3146

@dd32

Description

@dd32

The learn theme makes uncached calls to get_courses_average_grade() in the Course sidebar that causes a rather slow SQL query on certain pages.

This is mostly visible with courses that have been attempted by a lot of users.

Sensei code:
https://github.com/Automattic/sensei/blob/d1596603cd10e88260cd7f84831edcc9a137b203/includes/reports/overview/services/class-sensei-reports-overview-service-courses.php#L84-L108

We should ideally:

  • Cache the value on the post type (Either as postmeta, or in object cache)
  • Either calculate the average on a cron (postmeta), or update it upon course completion (postmeta, object cache + ondemand)
  • Switch to a stored Sensei meta value if one exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Component] Learn ThemeWebsite development issues related to the Learn theme.[Component] SenseiWebsite development issues related to the Sensei plugin installed on Learn.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions