add average-answer-time to Fluent

drop the 0.1 special case; we're using two decimals now
This commit is contained in:
Damien Elmes 2020-02-21 17:42:55 +10:00
parent a85bca51b2
commit 0fbe59cd57
2 changed files with 12 additions and 11 deletions

View file

@ -453,20 +453,15 @@ group by day order by day"""
)
if total and tot:
perMin = total / float(tot)
perMin = round(perMin, 1)
# don't round down to zero
if perMin < 0.1:
text = _("less than 0.1 cards/minute")
else:
text = _("%.01f cards/minute") % perMin
average_secs = (tot * 60) / total
self._line(
i,
_("Average answer time"),
# T: For example, in the statistics line: " Average
# answer time: 16.8s (3.6 cards/minute)", then
# "%(a)0.1fs" represents "16.8s" and "%(b)s" represents
# "3.6 cards/minutes")
_("%(a)0.1fs (%(b)s)") % dict(a=(tot * 60) / total, b=text),
self.col.backend.translate(
StringsGroup.STATISTICS,
"average-answer-time",
**{"cards-per-minute": perMin, "average-seconds": average_secs},
),
)
return self._lineTbl(i), int(tot)

View file

@ -4,3 +4,9 @@ due-date = Due
due-count = Due
# Shown in the Due column of the Browse screen when the card is a new card
due-for-new-card = New #{$number}
## eg 16.8s (3.6 cards/minute)
cards-per-min = {$cards-per-minute} cards/minute
average-answer-time = {$average-seconds}s ({cards-per-min})