Skip to content

Commit

Permalink
refactor: test mode filter is weird
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Waldstein committed Nov 10, 2023
1 parent 367a1b1 commit c719922
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/Donations/Endpoints/ListDonations.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,25 +276,20 @@ private function getWhereConditions(QueryBuilder $query): array
}

if ($hasWhereConditions) {
$query->having(
if ($testMode){
$query->having(
'give_donationmeta_attach_meta_mode.meta_value',
'=',
$testMode ? DonationMode::TEST : DonationMode::LIVE
);

if (!$testMode) {
$query->orHaving('give_donationmeta_attach_meta_mode.meta_value', '=', '');
DonationMode::TEST
);
}
} elseif ($testMode){
} elseif ($testMode) {
$query->where('give_donationmeta_attach_meta_mode.meta_value', DonationMode::TEST);
} else {
$query->whereIsNull('give_donationmeta_attach_meta_mode.meta_value')
->orWhere('give_donationmeta_attach_meta_mode.meta_value', DonationMode::LIVE)
->orWhere('give_donationmeta_attach_meta_mode.meta_value', DonationMode::TEST, '<>');
->orWhere('give_donationmeta_attach_meta_mode.meta_value', DonationMode::TEST, '<>');
}



return [
$query,
$dependencies,
Expand Down

0 comments on commit c719922

Please sign in to comment.