diff --git a/pylib/tests/test_schedv1.py b/pylib/tests/test_schedv1.py index edff07beb..d59264997 100644 --- a/pylib/tests/test_schedv1.py +++ b/pylib/tests/test_schedv1.py @@ -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(): diff --git a/pylib/tests/test_schedv2.py b/pylib/tests/test_schedv2.py index 2b8f996ac..0df6c2005 100644 --- a/pylib/tests/test_schedv2.py +++ b/pylib/tests/test_schedv2.py @@ -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(): diff --git a/rslib/src/sched/timespan.rs b/rslib/src/sched/timespan.rs index b5725a7b1..9c496811e 100644 --- a/rslib/src/sched/timespan.rs +++ b/rslib/src/sched/timespan.rs @@ -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];