Skip to content

Read courses per-row Completions and Average Progress from HPPS - #8209

Draft
donnapep wants to merge 3 commits into
hpps-reports-courses-avg-gradefrom
hpps-reports-courses-completions-progress
Draft

Read courses per-row Completions and Average Progress from HPPS#8209
donnapep wants to merge 3 commits into
hpps-reports-courses-avg-gradefrom
hpps-reports-courses-completions-progress

Conversation

@donnapep

@donnapep donnapep commented Aug 25, 2026

Copy link
Copy Markdown
Member

SEN-83: HPPS: Reports Overview aggregates → table-aware

Part of the Reports → Overview HPPS effort. Stacked on hpps-reports-courses-avg-grade.

Proposed Changes

  • Courses tab, per-row Completions and Average Progress columns: primed from the progress tables instead of per-row queries.
  • Average Progress shows N/A (not 0%) for a course with no enrolled students or no lessons.

Testing Instructions

Setup (HPPS enabled):

  • Course A: 2 lessons, 2 students enrolled. Student 1 completes both lessons and the course; student 2 completes neither.
  • Course B: has lessons but no enrolled students.

Verify at Reports → Overview → Courses:

  • Course A row: Completions = 1, Average Progress = 50% (2 of 4 possible lesson completions).
  • Course B row: Average Progress = N/A (not 0%).
  • Export the CSV; the same values appear.
  • Turn HPPS off, reload, and confirm the values are identical.

Deprecated Code

This per-row filter no longer runs. No replacement:

  • sensei_analysis_course_completions

@donnapep donnapep added this to the 4.26.4 milestone Aug 25, 2026
@donnapep donnapep added the Deprecation This change introduces a deprecation. label Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

WordPress Playground Preview

The changes in this pull request can previewed and tested using a WordPress Playground instance.

Open WordPress Playground Preview

donnapep and others added 3 commits August 25, 2026 11:24
Extract the per-course average progress calculation out of
get_total_average_progress() into a new public
get_average_progress_per_course() method, so the courses list table can
prime per-row progress from primed table-aware data instead of running
per-row comment queries. get_total_average_progress() now sums the
per-course values, keeping its return value unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the courses list table's remaining per-row comment queries
(completions, feeding both the completions and completion_rate columns,
and average_progress) with cache lookups primed for the current page via
count_statuses_by_post() and the new
get_average_progress_per_course() service method. This makes both
columns storage-aware in HPPS mode, same as the other columns on this
table. Also deprecates the now-unused sensei_analysis_course_completions
filter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A course with no enrolled students or no lessons has no computable
average progress. Restore the previous N/A display for those courses
instead of showing 0%, which wrongly implied zero progress.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@donnapep
donnapep force-pushed the hpps-reports-courses-avg-grade branch from 0558d49 to 39962d5 Compare August 25, 2026 15:26
@donnapep
donnapep force-pushed the hpps-reports-courses-completions-progress branch from 60acda6 to fc9a88a Compare August 25, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deprecation This change introduces a deprecation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant