Skip to content

Commit

Permalink
NA - Update auctions ending soon threshold (#926)
Browse files Browse the repository at this point in the history
* update threshold to 120, include equals in eval logic

* add hour in seconds
  • Loading branch information
jaspercroome authored Apr 30, 2024
1 parent ec3d838 commit 26f2829
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions client-mu-plugins/goodbids/src/classes/Auctions/Auction.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,19 +539,10 @@ public function is_ending_soon(): bool {
return false;
}

// commenting out extension logic for now
// TODO add a variable in the UI for 'ending soon notification threshold'
// $extension = $this->get_bid_extension();

$static_threshold_min = 60*60; // 60 minutes
$static_threshold_max = 60*115; // 115 minutes

// if ( ! $extension ) {
// return false;
// }

// Set threshold to be static
// $threshold = intval( round( $extension * .3 ) );

$static_threshold_min = HOUR_IN_SECONDS * 1; // 60 minutes
$static_threshold_max = HOUR_IN_SECONDS * 2; // 120 minutes

try {
$end = new DateTimeImmutable( $end_date_time, wp_timezone() );
Expand All @@ -570,7 +561,7 @@ public function is_ending_soon(): bool {
// and the diff is more than the min for the threshold
// (i.e., if it falls within the threshold),
// then it's ending soon.
$ending_soon = $static_threshold_max > $diff && $static_threshold_min < $diff;
$ending_soon = $static_threshold_max > $diff && $static_threshold_min <= $diff;

return $ending_soon;
}
Expand Down

0 comments on commit 26f2829

Please sign in to comment.