From ec263d0d63cca957a3b74c816f5f86fc1911d1b8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 29 Jan 2010 20:05:04 +0900 Subject: [PATCH] if there is a period, always use the plural --- anki/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/anki/utils.py b/anki/utils.py index d34360899..6d22c1af5 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -64,9 +64,9 @@ def fmtTimeSpan(time, pad=0, point=0, short=False, after=False): fmt = shortTimeTable[type] else: if after: - fmt = afterTimeTable[type](_pluralCount(round(time, point))) + fmt = afterTimeTable[type](_pluralCount(time, point)) else: - fmt = timeTable[type](_pluralCount(round(time, point))) + fmt = timeTable[type](_pluralCount(time, point)) timestr = "%(a)d.%(b)df" % {'a': pad, 'b': point} return locale.format_string("%" + (fmt % timestr), time) @@ -103,10 +103,10 @@ def convertSecondsTo(seconds, type): return seconds / 31536000.0 assert False -def _pluralCount(time): - if round(time, 1) == 1: - return 1 - return round(time, 1) +def _pluralCount(time, point): + if point: + return 2 + return round(time) # Locale ##############################################################################