Opened 17 years ago
Closed 17 years ago
#6457 closed defect (fixed)
Age field in revisions is too coarse
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | general | Version: | 0.10.4 |
Severity: | normal | Keywords: | consider |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
As date 2007-12-07 (ISO format date) I've two files commited in my repository. Both states age as "2 years" but closer inspection revealed that another was changed at 2005-07-13 and another 2006-05-30.
Error margin (almost 25%) is a bit too high considered that project itself is about 2 and half years old.
Attachments (0)
Change History (3)
comment:1 by , 17 years ago
Keywords: | needinfo added |
---|
comment:2 by , 17 years ago
Keywords: | consider added; needinfo removed |
---|---|
Milestone: | → 0.11.1 |
I think he was requesting that we use the previous unit for a range of values a bit extended, e.g.
-
trac/util/datefmt.py
diff --git a/trac/util/datefmt.py b/trac/util/datefmt.py
a b def pretty_timedelta(time1, time2=None, 85 85 return '%i second%s' % (age_s, age_s != 1 and 's' or '') 86 86 for u, unit, unit_plural in units: 87 87 r = float(age_s) / float(u) 88 if r >= 0.9:88 if r >= 1.9: 89 89 r = int(round(r)) 90 90 return '%d %s' % (r, r == 1 and unit or unit_plural) 91 91 return ''
This shows things like 23 months.
Note that the patch doesn't work for seconds though, at least it uncovered a bug in get_timeline_link
.
I'm siding with sid against decimal output if that's what was actually requested, but I think showing 2 years only if the age is actually above 23 months is better.
comment:3 by , 17 years ago
Milestone: | 0.11.1 → 0.11 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Above patch applied in r6658.
Just to clarify your request, are you asking for "Modified 2.5 years ago" or a decimal point for more information?
I like that dates/times are rounded to whole numbers. Quick and easy to visually scan. Approx age at that point is good enough for stuff we do.