]> source.dussan.org Git - redmine.git/commitdiff
Fixed: first day of date range is not included in time report with SQLite (#3112).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Nov 2009 17:35:20 +0000 (17:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Nov 2009 17:35:20 +0000 (17:35 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3009 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb
test/functional/timelog_controller_test.rb

index 90abb1ebf20cb239b44fc133d4f0b0e239edecf5..103168ea8d571065fd2c449e38bd7027c72e8663 100644 (file)
@@ -103,7 +103,7 @@ class TimelogController < ApplicationController
       sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id"
       sql << " WHERE"
       sql << " (%s) AND" % sql_condition
-      sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from.to_time), ActiveRecord::Base.connection.quoted_date(@to.to_time)]
+      sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)]
       sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on"
       
       @hours = ActiveRecord::Base.connection.select_all(sql)
index d689e9e8a72eb935124e7c70183c23f51eaa9b73..afddc7cb4c47179359448e8c130d37caca21280e 100644 (file)
@@ -229,6 +229,14 @@ class TimelogControllerTest < ActionController::TestCase
     assert_equal "162.90", "%.2f" % assigns(:total_hours)
   end
   
+  def test_report_one_day
+    get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"]
+    assert_response :success
+    assert_template 'report'
+    assert_not_nil assigns(:total_hours)
+    assert_equal "4.25", "%.2f" % assigns(:total_hours)
+  end
+  
   def test_report_at_issue_level
     get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
     assert_response :success
@@ -337,6 +345,14 @@ class TimelogControllerTest < ActionController::TestCase
     assert_equal Date.today - 7, assigns(:from)
     assert_equal Date.today, assigns(:to)
   end
+
+  def test_details_one_day
+    get :details, :project_id => 1, :from => "2007-03-23", :to => "2007-03-23"
+    assert_response :success
+    assert_template 'details'
+    assert_not_nil assigns(:total_hours)
+    assert_equal "4.25", "%.2f" % assigns(:total_hours)
+  end
   
   def test_issue_details_routing
     assert_routing(