From 747d6f1d11037d79946396270f59fc9aa11cc629 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Wed, 31 Dec 2008 16:43:44 +0000 Subject: [PATCH] Revert last commit - too many test failures --- app/controllers/browse_controller.rb | 2 +- app/controllers/changeset_controller.rb | 6 +++--- app/views/changeset/_changeset.rhtml | 2 +- test/fixtures/changesets.yml | 6 +++--- test/functional/browse_controller_test.rb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 151a7e11e..237c57ab2 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -8,7 +8,7 @@ class BrowseController < ApplicationController end def index - @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', Time.now], :limit=> 20) + @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20) end def relation diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 8f882e80e..c820aa705 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -376,11 +376,11 @@ private times = time.split(/,/) raise OSM::APIBadUserInput.new("bad time range") if times.size != 2 - from, to = times.collect { |t| Time.parse(t) } + from, to = times.collect { |t| DateTime.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 >= ?', Time.parse(time)] + return ['closed_at >= ?', DateTime.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 >= ?', Time.now] + return open.nil? ? nil : ['closed_at >= ?', DateTime.now] end end diff --git a/app/views/changeset/_changeset.rhtml b/app/views/changeset/_changeset.rhtml index e9c07f94f..83b0b0ce8 100644 --- a/app/views/changeset/_changeset.rhtml +++ b/app/views/changeset/_changeset.rhtml @@ -5,7 +5,7 @@ #<%= changeset.id %> - <% if changeset.closed_at > Time.now %> (still editing) + <% if changeset.closed_at > DateTime.now %> (still editing) <% else %><%= changeset.closed_at.strftime("%d %b %Y %H:%M") %><% end %> diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml index 9e559729f..defd691d2 100644 --- a/test/fixtures/changesets.yml +++ b/test/fixtures/changesets.yml @@ -7,7 +7,7 @@ normal_user_first_change: id: 1 user_id: 1 created_at: "2007-01-01 00:00:00" - closed_at: <%= Time.now + 1.hour %> + closed_at: <%= DateTime.now + Rational(1,24) %> 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: <%= Time.now + 1.hour %> + closed_at: <%= DateTime.now + Rational(1,24) %> 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: <%= Time.now + 1.hour %> + closed_at: <%= DateTime.now + Rational(1,24) %> min_lon: <%= 1 * SCALE %> min_lat: <%= 1 * SCALE %> max_lon: <%= 4 * SCALE %> diff --git a/test/functional/browse_controller_test.rb b/test/functional/browse_controller_test.rb index 7be3f8497..c4d7a5ae4 100644 --- a/test/functional/browse_controller_test.rb +++ b/test/functional/browse_controller_test.rb @@ -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 < ?', Time.now], :limit=> 20) + @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20) assert @changesets.size <= 20 get :index assert_response :success -- 2.43.2