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 @@ @@ -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 \ No newline at end of file 6 \ No newline at end of file
app/views/repositories/show.html.erb
@@ -23,15 +23,15 @@ @@ -23,15 +23,15 @@
23 </p> 23 </p>
24 24
25 <p> 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 </p> 28 </p>
29 29
30 <% unless @processing.process_times.nil? %> 30 <% unless @processing.process_times.nil? %>
31 <% @processing.process_times.each do |process_time| %> 31 <% @processing.process_times.each do |process_time| %>
32 <p> 32 <p>
33 <strong><%= process_time.state %> time:</strong> 33 <strong><%= process_time.state %> time:</strong>
34 - <%= process_time.time %> 34 + <%= humanize_eplased_time(process_time.time) %>
35 </p> 35 </p>
36 <% end %> 36 <% end %>
37 <% end %> 37 <% end %>
spec/helpers/.keep
spec/helpers/processings_helper_spec.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -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 \ No newline at end of file 10 \ No newline at end of file