cap answer buttons to 1 decimal place
we can switch to NUMBER() instead in the future, but will need to update all the translations at the same time
This commit is contained in:
parent
c58b4158a7
commit
b1a192b384
@ -516,7 +516,7 @@ def test_nextIvl():
|
||||
assert ni(c, 3) == 21600000
|
||||
# (* 100 2.5 1.3 86400)28080000.0
|
||||
assert ni(c, 4) == 28080000
|
||||
assert without_unicode_isolation(d.sched.nextIvlStr(c, 4)) == "10.83mo"
|
||||
assert without_unicode_isolation(d.sched.nextIvlStr(c, 4)) == "10.8mo"
|
||||
|
||||
|
||||
def test_misc():
|
||||
|
@ -613,7 +613,7 @@ def test_nextIvl():
|
||||
assert ni(c, 3) == 21600000
|
||||
# (* 100 2.5 1.3 86400)28080000.0
|
||||
assert ni(c, 4) == 28080000
|
||||
assert without_unicode_isolation(d.sched.nextIvlStr(c, 4)) == "10.83mo"
|
||||
assert without_unicode_isolation(d.sched.nextIvlStr(c, 4)) == "10.8mo"
|
||||
|
||||
|
||||
def test_bury():
|
||||
|
@ -7,8 +7,9 @@ use crate::i18n::{tr_args, FString, I18n};
|
||||
pub fn answer_button_time(seconds: f32, i18n: &I18n) -> String {
|
||||
let span = Timespan::from_secs(seconds).natural_span();
|
||||
let amount = match span.unit() {
|
||||
TimespanUnit::Months | TimespanUnit::Years => span.as_unit(),
|
||||
// we don't show fractional values except for months/years
|
||||
// months/years shown with 1 decimal place
|
||||
TimespanUnit::Months | TimespanUnit::Years => (span.as_unit() * 10.0).round() / 10.0,
|
||||
// other values shown without decimals
|
||||
_ => span.as_unit().round(),
|
||||
};
|
||||
let args = tr_args!["amount" => amount];
|
||||
|
Loading…
Reference in New Issue
Block a user