Skip to content

Revert "Use parent_post_id instead of postmeta joins in HPPS services"#7949

Merged
donnapep merged 1 commit into
trunkfrom
revert-7930-refactor/use-parent-post-id-in-hpps-services
Apr 22, 2026
Merged

Revert "Use parent_post_id instead of postmeta joins in HPPS services"#7949
donnapep merged 1 commit into
trunkfrom
revert-7930-refactor/use-parent-post-id-in-hpps-services

Conversation

@donnapep
Copy link
Copy Markdown
Member

Reverts #7930 based on this discussion - #7931 (comment).

@donnapep donnapep added this to the 4.26.0 milestone Apr 21, 2026
@donnapep donnapep self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 23:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reverts the prior HPPS services change that relied on sensei_lms_progress.parent_post_id, switching tables-based services back to using WordPress postmeta joins (_lesson_course, _lesson_quiz) to relate lessons, courses, and quizzes.

Changes:

  • Update tables-based progress/grading services to join through wp_postmeta instead of using parent_post_id.
  • Adjust grading/progress SQL to map lesson→course and lesson→quiz via _lesson_course / _lesson_quiz.
  • Update unit tests to align with the reverted behavior (including removing tests that asserted parent_post_id-based linking).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
includes/internal/services/class-tables-based-progress-clauses-service.php Reverts course/lesson clauses to use postmeta joins for last activity and days-to-completion.
includes/internal/services/class-tables-based-progress-aggregation-service.php Reverts aggregation queries to find quiz relationships via _lesson_quiz postmeta joins.
includes/internal/services/class-tables-based-grading-listing-service.php Reverts grading listing queries to join quiz progress/submissions via _lesson_quiz postmeta.
tests/unit-tests/test-class-grading.php Updates progress creation calls to omit parent_post_id args.
tests/unit-tests/internal/services/test-class-tables-based-progress-aggregation-service.php Removes test that asserted behavior specifically dependent on parent_post_id.
tests/unit-tests/internal/services/test-class-tables-based-grading-listing-service.php Removes test that asserted behavior specifically dependent on parent_post_id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@donnapep donnapep merged commit 85f1645 into trunk Apr 22, 2026
30 checks passed
@donnapep donnapep deleted the revert-7930-refactor/use-parent-post-id-in-hpps-services branch April 22, 2026 00:13
@donnapep donnapep removed this from the 4.26.0 milestone Apr 22, 2026
donnapep added a commit that referenced this pull request May 13, 2026
…ports

Mirrors the pattern restored by PR #7949 across the other HPPS services:
quiz progress rows are located via the lesson's _lesson_quiz postmeta,
and lesson-to-course aggregation goes through _lesson_course postmeta
instead of relying on lesson progress rows' parent_post_id.

Six queries in Tables_Based_Reports_Listing_Service updated:
get_lesson_students, get_course_students, get_user_lesson_progress,
get_user_courses, get_lesson_completion_count, get_lesson_average_grade.

Two existing tests now set _lesson_quiz on the lesson post since
Sensei_Factory::quiz->create() does not write that meta automatically;
the new query path requires it to find the quiz progress row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants