Skip to content

Commit

Permalink
[#910] Fix All Auctions End Date/time on Main Site (#915)
Browse files Browse the repository at this point in the history
* [#910] Fix All Auctions End Date/time on Main Site

* [#910] Add seconds to time left

* [#910] Restore All Auctions Transient
  • Loading branch information
bd-viget authored Apr 17, 2024
1 parent e448053 commit dc24f09
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
10 changes: 5 additions & 5 deletions client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();

Expand Down
16 changes: 8 additions & 8 deletions client-mu-plugins/goodbids/src/classes/Network/Sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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;
}
Expand Down
10 changes: 1 addition & 9 deletions client-mu-plugins/goodbids/views/parts/auction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -131,14 +131,6 @@
<?php echo esc_html( $auction->get_watch_count() ); ?>
</div>
</div>
<div style="font-size:11px">
<div>End Date/Time: <?php echo esc_html( $auction->get_end_date_time() ); ?></div>
<div>End Date/Time (Original): <?php echo esc_html( $auction->get_original_end_date_time() ); ?></div>
<div>Close Date/Time: <?php echo esc_html( get_post_meta( $auction->get_id(), Auctions::AUCTION_CLOSE_META_KEY, true ) ); ?></div>
<div>Extensions: <?php echo esc_html( $auction->get_extensions() ); ?></div>
<div>Extension Window: <?php echo esc_html( $auction->get_bid_extension_formatted() ); ?></div>
<div>Site ID: <?php echo esc_html( get_current_blog_id() ); ?></div>
</div>
</li>
<?php
wp_reset_postdata();

0 comments on commit dc24f09

Please sign in to comment.