Auto commit for release 'branch-v6.2' on 2024-12-23

This commit is contained in:
github-actions
2024-12-23 08:40:29 +01:00
parent e1785898ba
commit ddfededf02
5 changed files with 2982 additions and 2943 deletions

View File

@@ -214,9 +214,9 @@ trait AccountCollection
$this->query->leftJoin('account_types as source_account_type', 'source_account_type.id', '=', 'source_account.account_type_id');
// add source account fields:
$this->fields[] = 'source_account.name as source_account_name';
$this->fields[] = 'source_account.iban as source_account_iban';
$this->fields[] = 'source_account_type.type as source_account_type';
$this->fields[] = 'source_account.name as source_account_name';
$this->fields[] = 'source_account.iban as source_account_iban';
$this->fields[] = 'source_account_type.type as source_account_type';
// same for dest
$this->query->leftJoin('accounts as dest_account', 'dest_account.id', '=', 'destination.account_id');
@@ -232,7 +232,8 @@ trait AccountCollection
return $this;
}
#[\Override] public function accountBalanceIs(string $direction, string $operator, string $value): GroupCollectorInterface
#[\Override]
public function accountBalanceIs(string $direction, string $operator, string $value): GroupCollectorInterface
{
Log::warning(sprintf('GroupCollector will be SLOW: accountBalanceIs: "%s" "%s" "%s"', $direction, $operator, $value));
@@ -251,35 +252,49 @@ trait AccountCollection
return false;
}
// in theory, this could lead to finding other users accounts.
$balance = Steam::finalAccountBalance(Account::find($accountId), $transaction['date']);
$result = bccomp($balance['balance'], $value);
$balance = Steam::finalAccountBalance(Account::find($accountId), $transaction['date']);
$result = bccomp($balance['balance'], $value);
Log::debug(sprintf('"%s" vs "%s" is %d', $balance['balance'], $value, $result));
switch ($operator) {
default:
Log::error(sprintf('GroupCollector: accountBalanceIs: unknown operator "%s"', $operator));
return false;
case '==':
Log::debug('Expect result to be 0 (equal)');
return 0 === $result;
case '!=':
Log::debug('Expect result to be -1 or 1 (not equal)');
return 0 !== $result;
case '>':
Log::debug('Expect result to be 1 (greater then)');
return 1 === $result;
case '>=':
Log::debug('Expect result to be 0 or 1 (greater then or equal)');
return -1 !== $result;
case '<':
Log::debug('Expect result to be -1 (less than)');
return -1 === $result;
case '<=':
Log::debug('Expect result to be -1 or 0 (less than or equal)');
return 1 !== $result;
}
//if($balance['balance'] $operator $value) {
// if($balance['balance'] $operator $value) {
//}
// }
}
return false;