Rename ore_to_nok to kroner_whole and print whole kroner

This commit is contained in:
ai-bot committed 2026-11-14 17:55:40 +00:00
1 parent accc235022
commit b044b0b5ad
1 file changed
+4 -4
+4 -4
View File
@@ -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