From dc24f091fc029b8cd173b56e10467c174449ce33 Mon Sep 17 00:00:00 2001 From: Brian DiChiara <122309362+bd-viget@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:05:34 -0500 Subject: [PATCH] [#910] Fix All Auctions End Date/time on Main Site (#915) * [#910] Fix All Auctions End Date/time on Main Site * [#910] Add seconds to time left * [#910] Restore All Auctions Transient --- .../goodbids/src/classes/Auctions/Auctions.php | 10 +++++----- .../goodbids/src/classes/Network/Sites.php | 16 ++++++++-------- .../goodbids/views/parts/auction.php | 10 +--------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php index fc73fafd2..f87433b24 100644 --- a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php +++ b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php @@ -86,8 +86,11 @@ class Auctions { * @since 1.0.0 */ public function __construct() { - // Disable Auctions on Main Site, but not locally for debugging. - if ( is_main_site() && ! Core::is_local_env() ) { + // Override End Date/Time (used in All Auctions block). + $this->override_end_date_time(); + + // Disable Auctions on Main Site. + if ( is_main_site() ) { return; } @@ -118,9 +121,6 @@ public function __construct() { // Clear metric transients on new Bid Order. $this->maybe_clear_metric_transients(); - // Override End Date/Time. - $this->override_end_date_time(); - // Extend the Auction time after bids within extension window. $this->maybe_extend_auction_on_order_complete(); diff --git a/client-mu-plugins/goodbids/src/classes/Network/Sites.php b/client-mu-plugins/goodbids/src/classes/Network/Sites.php index aa421ee05..c79848702 100644 --- a/client-mu-plugins/goodbids/src/classes/Network/Sites.php +++ b/client-mu-plugins/goodbids/src/classes/Network/Sites.php @@ -753,11 +753,11 @@ function (): string { * @return array */ public function get_all_auctions( array $query_args = [] ): array { -// $auctions = empty( $query_args ) ? get_transient( self::ALL_AUCTIONS_TRANSIENT ) : false; -// -// if ( $auctions ) { -// return $auctions; -// } + $auctions = empty( $query_args ) ? get_transient( self::ALL_AUCTIONS_TRANSIENT ) : false; + + if ( $auctions ) { + return $auctions; + } $auctions = $this->loop( fn ( int $site_id ) => collect( ( goodbids()->auctions->get_all( $query_args ) )->posts ) @@ -783,9 +783,9 @@ function () { ->all() ); -// if ( empty( $query_args ) ) { -// set_transient( self::ALL_AUCTIONS_TRANSIENT, $auctions, DAY_IN_SECONDS ); -// } + if ( empty( $query_args ) ) { + set_transient( self::ALL_AUCTIONS_TRANSIENT, $auctions, DAY_IN_SECONDS ); + } return $auctions; } diff --git a/client-mu-plugins/goodbids/views/parts/auction.php b/client-mu-plugins/goodbids/views/parts/auction.php index 5746cbf9b..418726b03 100644 --- a/client-mu-plugins/goodbids/views/parts/auction.php +++ b/client-mu-plugins/goodbids/views/parts/auction.php @@ -52,7 +52,7 @@ $clock_svg = true; } elseif ( $remaining_time->h <= 0 && $remaining_time->i >= 1 ) { // Less than 1 hour remaining. $time_class .= 'text-gb-red-500'; - $time = $remaining_time->format( '%im' ); + $time = $remaining_time->format( '%im %ss' ); $clock_svg = true; } elseif ( $remaining_time->i <= 0 && $remaining_time->s >= 1 ) { // Less than 1 minute remaining. $time_class .= 'text-gb-red-500'; @@ -131,14 +131,6 @@ get_watch_count() ); ?> -