Project

General

Profile

Actions

Bug #1618

closed

Time drift incorrectly worded

Added by Greg Sutcliffe about 12 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
Difficulty:
trivial
Triaged:
No
Fixed in Releases:
Found in Releases:

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.

Actions #1

Updated by Greg Sutcliffe about 12 years 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 = "")
Actions #2

Updated by Ohad Levy about 12 years ago

  • Assignee set to Greg Sutcliffe
  • Target version set to 1.0

does this also changes the report drift warning message?
git formatted patch? :)

Actions #3

Updated by Greg Sutcliffe about 12 years 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)

Actions #4

Updated by Ohad Levy almost 12 years ago

  • Difficulty set to trivial
Actions #5

Updated by Ohad Levy almost 12 years ago

  • Target version deleted (1.0)

if you have the time, we'll add it to 1.0, if not, next release :)

Actions #6

Updated by The Foreman Bot over 4 years ago

  • Description updated (diff)
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7313 added
Actions #7

Updated by Tomer Brisker over 4 years ago

  • Status changed from Ready For Testing to Resolved

this has been resolved by the change to react relative date component.

Actions

Also available in: Atom PDF