mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Expand filter
This commit is contained in:
@@ -32,6 +32,7 @@ use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Maybe this is a good idea after all...
|
||||
@@ -631,13 +632,24 @@ class JournalCollector implements JournalCollectorInterface
|
||||
$new = new Collection;
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($set as $transaction) {
|
||||
if ($transaction->transaction_type_type !== TransactionType::TRANSFER) {
|
||||
$new->push($transaction);
|
||||
continue;
|
||||
}
|
||||
// make property string:
|
||||
$journalId = $transaction->transaction_journal_id;
|
||||
if(!isset($count[$journalId]) ) {
|
||||
$amount = Steam::positive($transaction->transaction_amount);
|
||||
$source = $transaction->account_id;
|
||||
$dest = $transaction->opposing_account_id;
|
||||
$key = $journalId . $source . $dest . $amount;
|
||||
|
||||
if (!isset($count[$key])) {
|
||||
// not yet counted? add to new set and count it:
|
||||
$new->push($transaction);
|
||||
$count[$journalId] = 1;
|
||||
$count[$key] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,6 @@ use FireflyIII\Models\Transaction;
|
||||
class Steam
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
@@ -202,8 +201,6 @@ class Steam
|
||||
return $list;
|
||||
}
|
||||
|
||||
// parse PHP size:
|
||||
|
||||
/**
|
||||
* @param $string
|
||||
*
|
||||
@@ -239,4 +236,20 @@ class Steam
|
||||
|
||||
}
|
||||
|
||||
// parse PHP size:
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function positive(string $amount): string
|
||||
{
|
||||
if (bccomp($amount, '0') === 1) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user