Commit ebdd98c33bb59b2a0c037be065114d9f7f4400b8

Authored by Rafael Manzo
1 parent 335629fd

Processing date, and durations are now human readable

app/helpers/processings_helper.rb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +module ProcessingsHelper
  2 + def humanize_eplased_time duration_in_milliseconds
  3 + distance_of_time_in_words(Time.now, (duration_in_milliseconds/1000.0).seconds.from_now)
  4 + end
  5 +end
0 6 \ No newline at end of file
... ...
app/views/repositories/show.html.erb
... ... @@ -23,15 +23,15 @@
23 23 </p>
24 24  
25 25 <p>
26   - <strong>Date:</strong>
27   - <%= @processing.date %>
  26 + <strong>Creation date:</strong>
  27 + <%= @processing.date.strftime("%Y/%m/%d at %Hh%M (%z)") %>
28 28 </p>
29 29  
30 30 <% unless @processing.process_times.nil? %>
31 31 <% @processing.process_times.each do |process_time| %>
32 32 <p>
33 33 <strong><%= process_time.state %> time:</strong>
34   - <%= process_time.time %>
  34 + <%= humanize_eplased_time(process_time.time) %>
35 35 </p>
36 36 <% end %>
37 37 <% end %>
... ...
spec/helpers/.keep
spec/helpers/processings_helper_spec.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +require 'spec_helper'
  2 +
  3 +describe ProcessingsHelper do
  4 + describe 'humanize_eplased_time' do
  5 + it 'should convert it to readable words' do
  6 + helper.humanize_eplased_time(6000).should eq('less than a minute')
  7 + end
  8 + end
  9 +end
0 10 \ No newline at end of file
... ...