Ditch floating point numbers, use cents instead; bump version to 3.2

This commit is contained in:
Juerd Waalboer 2021-12-02 22:07:58 +01:00
parent 9b582d5f9b
commit 38a0229899
17 changed files with 545 additions and 168 deletions

View file

@ -41,9 +41,9 @@ sub hook_user_created {
sub hook_user_balance {
my ($class, $user, $old, $delta, $new, $transaction_id) = @_;
$_ = sprintf "%+.02f", $_ for $old, $delta, $new;
my $lost = $delta < 0 ? "lost" : "got";
$delta = abs($delta);
$delta = $delta->abs;
$_ = $_->string("+") for $old, $new;
_log("BALANCE $transaction_id $user had $old, $lost $delta, now has $new");
}