Bug #1618
Time drift incorrectly worded
| Status: | New | Start: | 05/14/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - | |||
| Backlog: | No | Difficulity: | trivial | |
| Votes: | 0 |
Description
If the clocks on your client drifts ahead of the master, you can recieve reports from "the future". However, wording on the reports page is hardcoded to "ago" meaning you get:
about 1 hour ago 27 minutes ago 3 minutes ago 33 minutes ago about 1 hour ago
This is confusing. Reports from the future should be worded clearly, for example:
about 1 hour ahead 27 minutes ahead 3 minutes ago 33 minutes ago about 1 hour ago
This makes it clear that there is a time problem, straight from the reports overview.
History
Updated by Greg Sutcliffe about 1 year ago
The following patch works for my use case but could probably be improved:
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index e34afb8..1758283 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -2,7 +2,8 @@ require 'ostruct'
module ReportsHelper
def reported_at_column(record)
- link_to(time_ago_in_words(record.reported_at.getlocal) + " ago", report_path(record))
+ word = record.reported_at.getlocal > Time.now ? " ahead" : " ago"
+ link_to(time_ago_in_words(record.reported_at.getlocal) + word, report_path(record))
end
def report_event_column(event, style = "")
Updated by Ohad Levy about 1 year ago
- Assigned to set to Greg Sutcliffe
- Target version set to 1.0
does this also changes the report drift warning message?
git formatted patch? :)
Updated by Greg Sutcliffe about 1 year ago
I'll check, and send a pullreq. This was tested on my production 0.4 box anyway, so I need to check it works in 0.5 (probably though :P)
Updated by Ohad Levy about 1 year ago
- Difficulity set to trivial
