From ce755f50c16ad397bdf7f87a903c0ae0ff9ca5b3 Mon Sep 17 00:00:00 2001 From: savvasha Date: Thu, 7 Jul 2022 20:43:16 +0300 Subject: [PATCH] FIX3: Loss condition was not applied on event results --- .../class-sp-meta-box-event-results.php | 26 ++++++++++++++++--- includes/class-sp-event.php | 26 ++++++++++++++++--- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-results.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-results.php index f08ebff4..7eda4a9f 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-results.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-results.php @@ -187,8 +187,17 @@ class SP_Meta_Box_Event_Results { 'post_type' => 'sp_outcome', 'numberposts' => -1, 'posts_per_page' => -1, - 'meta_key' => 'sp_condition', - 'meta_value' => '>', + 'meta_query' => array( + 'relation' => 'OR', + array( + 'key' => 'sp_condition', + 'value' => '>', + ), + array( + 'key' => 'sp_condition', + 'value' => '>', + ), + ), ); $gt_outcomes = get_posts( $args ); if ( empty( $gt_outcomes ) ) { @@ -200,8 +209,17 @@ class SP_Meta_Box_Event_Results { 'post_type' => 'sp_outcome', 'numberposts' => -1, 'posts_per_page' => -1, - 'meta_key' => 'sp_condition', - 'meta_value' => '<', + 'meta_query' => array( + 'relation' => 'OR', + array( + 'key' => 'sp_condition', + 'value' => '<', + ), + array( + 'key' => 'sp_condition', + 'value' => '<', + ), + ), ); $lt_outcomes = get_posts( $args ); if ( empty( $lt_outcomes ) ) { diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php index 4db7303d..1289bd12 100644 --- a/includes/class-sp-event.php +++ b/includes/class-sp-event.php @@ -741,8 +741,17 @@ class SP_Event extends SP_Custom_Post { 'post_type' => 'sp_outcome', 'numberposts' => -1, 'posts_per_page' => -1, - 'meta_key' => 'sp_condition', - 'meta_value' => '>', + 'meta_query' => array( + 'relation' => 'OR', + array( + 'key' => 'sp_condition', + 'value' => '>', + ), + array( + 'key' => 'sp_condition', + 'value' => '>', + ), + ), ); $gt_outcomes = get_posts( $args ); if ( empty( $gt_outcomes ) ) { @@ -754,8 +763,17 @@ class SP_Event extends SP_Custom_Post { 'post_type' => 'sp_outcome', 'numberposts' => -1, 'posts_per_page' => -1, - 'meta_key' => 'sp_condition', - 'meta_value' => '<', + 'meta_query' => array( + 'relation' => 'OR', + array( + 'key' => 'sp_condition', + 'value' => '<', + ), + array( + 'key' => 'sp_condition', + 'value' => '<', + ), + ), ); $lt_outcomes = get_posts( $args ); if ( empty( $lt_outcomes ) ) {