mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
limit GDD to 2 decimal places
This commit is contained in:
parent
39fff3e42a
commit
9bcd56f969
@ -3,6 +3,7 @@ namespace App\Model\Entity;
|
||||
|
||||
use Cake\ORM\Entity;
|
||||
use Cake\I18n\Time;
|
||||
use Cake\I18n\Number;
|
||||
|
||||
/**
|
||||
* StateBalance Entity
|
||||
@ -70,7 +71,7 @@ class StateBalance extends Entity
|
||||
|
||||
protected function _getAmountFloat()
|
||||
{
|
||||
return floatval($this->amount) / 10000.0;
|
||||
return Number::format(floatval($this->amount) / 10000.0, ['precision' => 2]);
|
||||
}
|
||||
|
||||
public function partDecay($target_date)
|
||||
|
||||
@ -6,7 +6,7 @@ use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\Validation\Validator;
|
||||
use Cake\ORM\TableRegistry;
|
||||
|
||||
use Cake\I18n\Number;
|
||||
/**
|
||||
* Transactions Model
|
||||
*
|
||||
@ -188,7 +188,7 @@ class TransactionsTable extends Table
|
||||
//echo "prev balance: " . $prev->balance . ", diff_amount: $diff_amount, summe: " . (-intval($prev->balance - $diff_amount)) . "<br>";
|
||||
$final_transactions[] = [
|
||||
'type' => 'decay',
|
||||
'balance' => floatval(-intval($prev->balance - $diff_amount)) / 10000.0,
|
||||
'balance' => Number::format(floatval(-intval($prev->balance - $diff_amount)) / 10000.0, ['precision' => 2]),
|
||||
'decay_duration' => $interval->format('%a days, %H hours, %I minutes, %S seconds'),
|
||||
'memo' => ''
|
||||
];
|
||||
@ -256,7 +256,7 @@ class TransactionsTable extends Table
|
||||
$state_balance->record_date = $su_transaction->balance_date;
|
||||
$final_transactions[] = [
|
||||
'type' => 'decay',
|
||||
'balance' => floatval(-intval($su_transaction->balance - $state_balance->decay)) / 10000,
|
||||
'balance' => Number::format(floatval(-intval($su_transaction->balance - $state_balance->decay)) / 10000.0, ['precision' => 2]),
|
||||
'decay_duration' => $su_transaction->balance_date->timeAgoInWords(),
|
||||
'memo' => ''
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user