mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add checking at least that decay balance is more than 0
This commit is contained in:
parent
617b3648f4
commit
c2d91a2096
@ -184,6 +184,8 @@ class TransactionsTable extends Table
|
|||||||
$calculated_decay = $stateBalancesTable->calculateDecay($prev->balance, $prev->balance_date, $current->balance_date, true);
|
$calculated_decay = $stateBalancesTable->calculateDecay($prev->balance, $prev->balance_date, $current->balance_date, true);
|
||||||
$balance = floatval($prev->balance - $calculated_decay['balance']);
|
$balance = floatval($prev->balance - $calculated_decay['balance']);
|
||||||
|
|
||||||
|
if($balance)
|
||||||
|
{
|
||||||
$final_transactions[] = [
|
$final_transactions[] = [
|
||||||
'type' => 'decay',
|
'type' => 'decay',
|
||||||
'balance' => $balance,
|
'balance' => $balance,
|
||||||
@ -192,6 +194,7 @@ class TransactionsTable extends Table
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sender or receiver when user has sended money
|
// sender or receiver when user has sended money
|
||||||
// group name if creation
|
// group name if creation
|
||||||
@ -262,6 +265,8 @@ class TransactionsTable extends Table
|
|||||||
}
|
}
|
||||||
$balance = floatval($su_transaction->balance - $calculated_decay['balance']);
|
$balance = floatval($su_transaction->balance - $calculated_decay['balance']);
|
||||||
|
|
||||||
|
if($balance)
|
||||||
|
{
|
||||||
$final_transactions[] = [
|
$final_transactions[] = [
|
||||||
'type' => 'decay',
|
'type' => 'decay',
|
||||||
'balance' => $balance,
|
'balance' => $balance,
|
||||||
@ -271,6 +276,7 @@ class TransactionsTable extends Table
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $final_transactions;
|
return $final_transactions;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user