]> git.openstreetmap.org Git - rails.git/commitdiff
DateTime => Time for consistency in changeset code, ok by shaun.
authorThomas Wood <grand.edgemaster@gmail.com>
Wed, 31 Dec 2008 16:33:02 +0000 (16:33 +0000)
committerThomas Wood <grand.edgemaster@gmail.com>
Wed, 31 Dec 2008 16:33:02 +0000 (16:33 +0000)
app/controllers/browse_controller.rb
app/controllers/changeset_controller.rb
app/views/changeset/_changeset.rhtml
test/fixtures/changesets.yml
test/functional/browse_controller_test.rb

index 237c57ab232db987f1b385100f01acf91289263f..151a7e11e5673e2f785fa5ad6699517a89d783cd 100644 (file)
@@ -8,7 +8,7 @@ class BrowseController < ApplicationController
   end
   
   def index
-    @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20)
+    @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', Time.now], :limit=> 20)
   end
   
   def relation 
index c820aa70528fb7daf7dfe1307e6caf07a06c5002..8f882e80e1849d81f868f29dae7c893987b5fa7a 100644 (file)
@@ -376,11 +376,11 @@ private
         times = time.split(/,/)
         raise OSM::APIBadUserInput.new("bad time range") if times.size != 2 
 
-        from, to = times.collect { |t| DateTime.parse(t) }
+        from, to = times.collect { |t| Time.parse(t) }
         return ['closed_at >= ? and created_at <= ?', from, to]
       else
         # if there is no comma, assume its a lower limit on time
-        return ['closed_at >= ?', DateTime.parse(time)]
+        return ['closed_at >= ?', Time.parse(time)]
       end
     else
       return nil
@@ -396,7 +396,7 @@ private
   ##
   # restrict changes to those which are open
   def conditions_open(open)
-    return open.nil? ? nil : ['closed_at >= ?', DateTime.now]
+    return open.nil? ? nil : ['closed_at >= ?', Time.now]
   end
 
 end
index 83b0b0ce879981fdd8e81d67d04ff8d6048aeadc..e9c07f94f44d0bcaeb07b93ec7e4dd8f3d1f61a5 100644 (file)
@@ -5,7 +5,7 @@
     #<%= changeset.id %>
 
   <td class="<%= cl %>">
-    <% if changeset.closed_at > DateTime.now %> (still editing)
+    <% if changeset.closed_at > Time.now %> (still editing)
     <% else %><%= changeset.closed_at.strftime("%d %b %Y %H:%M") %><% end %>
 
   <td class="<%= cl %>">
index defd691d2c773d67a4579cb37273fa72660fcdf0..9e559729f53cd55aa5702d9cf44ef227ade68387 100644 (file)
@@ -7,7 +7,7 @@ normal_user_first_change:
   id: 1
   user_id: 1
   created_at: "2007-01-01 00:00:00"
-  closed_at: <%= DateTime.now + Rational(1,24) %>
+  closed_at: <%= Time.now + 1.hour %>
   min_lon: <%= 1 * SCALE %>
   min_lat: <%= 1 * SCALE %>
   max_lon: <%= 5 * SCALE %>
@@ -18,7 +18,7 @@ second_user_first_change:
   id: 2
   user_id: 2
   created_at: "2008-05-01 01:23:45"
-  closed_at: <%= DateTime.now + Rational(1,24) %>
+  closed_at: <%= Time.now + 1.hour %>
   num_changes: 0
 
 normal_user_closed_change:
@@ -32,7 +32,7 @@ normal_user_version_change:
   id: 4
   user_id: 1
   created_at: "2008-01-01 00:00:00"
-  closed_at: <%= DateTime.now + Rational(1,24) %>
+  closed_at: <%= Time.now + 1.hour %>
   min_lon: <%= 1 * SCALE %>
   min_lat: <%= 1 * SCALE %>
   max_lon: <%= 4 * SCALE %>
index c4d7a5ae4d0ff4f6a9dc59fb9b75164ce8ee3751..7be3f849784d77b424378be21592a29a64558874 100644 (file)
@@ -20,7 +20,7 @@ class BrowseControllerTest < ActionController::TestCase
   
   # This should display the last 20 changesets closed.
   def test_index
-    @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20)
+    @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', Time.now], :limit=> 20)
     assert @changesets.size <= 20
     get :index
     assert_response :success