From b044b0b5adcb01976828d93926de926888060e07 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 14 Nov 2026 17:55:40 +0000 Subject: [PATCH] Rename ore_to_nok to kroner_whole and print whole kroner --- rates.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rates.py b/rates.py index 44e0ca4..b7feead 100644 --- a/rates.py +++ b/rates.py @@ -121,12 +121,12 @@ def nok_to_ore(text): return _apply_sign(negative, int(whole) * ORE_PER_NOK + int(fraction.ljust(2, "0"))) -def ore_to_nok(ore): - """Format integer ore as a Norwegian amount without the currency.""" +def kroner_whole(ore): + """Whole kroner, halves rounded up, grouped with spaces. No unit.""" ore = int(ore) negative = ore < 0 - ore = abs(ore) - text = "%s,%02d" % (group_int(ore // ORE_PER_NOK), ore % ORE_PER_NOK) + kroner = (2 * abs(ore) + ORE_PER_NOK) // (2 * ORE_PER_NOK) + text = group_int(kroner) return "-" + text if negative else text