Skip to content

Query Optimization#2799

Open
Anindra123 wants to merge 20 commits into
4.0.0-devfrom
bivas-v4
Open

Query Optimization#2799
Anindra123 wants to merge 20 commits into
4.0.0-devfrom
bivas-v4

Conversation

@Anindra123

@Anindra123 Anindra123 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Areas covered:

  • Admin Instructor List
  • Instructor Course List ( Also with Membership Only mode )
  • Instructor Dashboard
  • Instructor Quiz Attempts List
  • Instructor Assignment List
  • Learning Area
  • Course Details page
  • Student Certificate List page
  • Student Billing page ( Order list tab, Subscription tab and Invoice )
  • Student Dashboard
  • Student Quiz Attempts List Page
  • Checkout

@Anindra123 Anindra123 added the 4.0.0 Tutor v4.w0w label Jun 12, 2026
@Anindra123 Anindra123 marked this pull request as ready for review June 23, 2026 10:13
Comment thread classes/Template.php
* @return array
*/
public static function make_learning_area_sub_page_nav_items( $base_url = '' ): array {
public static function make_learning_area_sub_page_nav_items( $base_url = '', $is_completed_course = null ): array {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why need this dependency?
We have $tutor_is_course_completed global

Comment thread classes/Utils.php
$lessons = $wpdb->get_results(
$wpdb->prepare(
"SELECT items.ID
$course_first_lesson_cache_key = 'tutor_course_first_lesson_' . $course_id;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if $post_type is provided?

Comment thread classes/Utils.php

$user_id = $this->get_user_id( $user_id );

$completed_courses_cache_key = 'tutor_completed_courses_ids_by_user_' . $user_id;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use like this pattern

$cache_key = 'tutor_completed_courses_ids_by_user_' . $user_id;
$cached    = TutorCache::get( $cache_key );
if ( false !== $cached ) {
	return $cached;
}

Comment thread classes/Utils.php
);
}

$enrolled_courses_cache_key = 'tutor_enrolled_courses_ids_by_user_' . $user_id . '_bundle_' . $with_bundle_enrolled_courses;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Follow the mentioned pattern above and use it immediate after $user_id

$should_calculate_tax = Tax::should_calculate_tax();
$tax_included = Tax::is_tax_included_in_price();
$tax_rate = Tax::get_user_tax_rate();
$tax_rate = $should_calculate_tax ? Tax::get_user_tax_rate() : '';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rate should not be empty string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0.0 Tutor v4.w0w

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants