Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#910] Fix All Auctions End Date/time on Main Site #915

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();