revert amount formatting

This commit is contained in:
metamuffin 2024-11-06 19:40:01 +01:00
parent 51bc73ae4d
commit fdc4036187
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654

View file

@ -127,13 +127,12 @@ local function format(template, params)
end end
local function format_amount(amount, tag, classes) local function format_amount(amount, tag, classes)
local s = format("{+price.amount}", { -- local s = format("{+price.amount}", {
sign = amount > 0 and "{+price.sign.pos}" or "{+price.sign.neg}", -- sign = amount > 0 and "{+price.sign.pos}" or "{+price.sign.neg}",
amount = string.format("%.2f", math.abs(amount / 100)), -- amount = string.format("%.2f", math.abs(amount / 100)),
unit = config.unit or "" -- unit = config.unit or "€"
}) -- })
local s = string.format("%s%.02f%s", amount > 0 and "+" or "", amount / 100, config.unit or "")
-- local s = string.format("%s%.02f%s", amount > 0 and "+" or "", amount / 100, )
if tag == nil then return s end if tag == nil then return s end
return format( return format(
[[<{tag} class="amount-{sign} {classes}">{content}</{tag}>]], { [[<{tag} class="amount-{sign} {classes}">{content}</{tag}>]], {