Remove floats.

This commit is contained in:
James Cole
2022-12-27 21:13:18 +01:00
parent 75ce777090
commit 5e654786be
19 changed files with 48 additions and 49 deletions

View File

@@ -71,8 +71,8 @@ class Amount
*/
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, bool $coloured = null): string
{
$locale = app('steam')->getLocale();
$rounded = app('steam')->bcround($amount, $decimalPlaces);
$locale = app('steam')->getLocale();
$rounded = app('steam')->bcround($amount, $decimalPlaces);
$coloured = $coloured ?? true;
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);

View File

@@ -152,7 +152,7 @@ class FrontpageChartGenerator
$tempData[] = [
'name' => trans('firefly.no_category'),
'sum' => $currency['sum'],
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places'] ?? 2),
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places'] ?? 2), // intentional float
'currency_id' => (int) $currency['currency_id'],
];
}

View File

@@ -130,8 +130,8 @@ trait ModelInformation
$billTriggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
$values = [
$bill->transactionCurrency()->first()->name,
round((float) $bill->amount_min, 24),
round((float) $bill->amount_max, 24),
$bill->amount_min,
$bill->amount_max,
$bill->name,
];
foreach ($billTriggers as $index => $trigger) {

View File

@@ -590,8 +590,10 @@ class Steam
if ($mantis < 0) {
$post += abs((int)$mantis);
}
// TODO careless float could break financial math.
return number_format((float)$value, $post, '.', '');
}
// TODO careless float could break financial math.
return number_format((float)$value, 0, '.', '');
}