Query Optimization#2799
Open
Anindra123 wants to merge 20 commits into
Open
Conversation
…licate query fixes
harunollyo
requested changes
Jun 26, 2026
| * @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 { |
Collaborator
There was a problem hiding this comment.
Why need this dependency?
We have $tutor_is_course_completed global
| $lessons = $wpdb->get_results( | ||
| $wpdb->prepare( | ||
| "SELECT items.ID | ||
| $course_first_lesson_cache_key = 'tutor_course_first_lesson_' . $course_id; |
Collaborator
There was a problem hiding this comment.
What if $post_type is provided?
|
|
||
| $user_id = $this->get_user_id( $user_id ); | ||
|
|
||
| $completed_courses_cache_key = 'tutor_completed_courses_ids_by_user_' . $user_id; |
Collaborator
There was a problem hiding this comment.
Use like this pattern
$cache_key = 'tutor_completed_courses_ids_by_user_' . $user_id;
$cached = TutorCache::get( $cache_key );
if ( false !== $cached ) {
return $cached;
}| ); | ||
| } | ||
|
|
||
| $enrolled_courses_cache_key = 'tutor_enrolled_courses_ids_by_user_' . $user_id . '_bundle_' . $with_bundle_enrolled_courses; |
Collaborator
There was a problem hiding this comment.
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() : ''; |
Collaborator
There was a problem hiding this comment.
Rate should not be empty string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Areas covered: