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