Removed unnecessary calculations in time entries index.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8085 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-12-04 23:01:42 +00:00
parent 9e5ed4208b
commit 1050993348
4 changed files with 17 additions and 75 deletions
+5 -5
View File
@@ -270,8 +270,8 @@ class TimelogControllerTest < ActionController::TestCase
assert_not_nil assigns(:total_hours)
assert_equal "162.90", "%.2f" % assigns(:total_hours)
# display all time by default
assert_equal '2007-03-12'.to_date, assigns(:from)
assert_equal '2007-04-22'.to_date, assigns(:to)
assert_nil assigns(:from)
assert_nil assigns(:to)
assert_tag :form,
:attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'}
end
@@ -320,9 +320,9 @@ class TimelogControllerTest < ActionController::TestCase
assert_equal 2, assigns(:entries).size
assert_not_nil assigns(:total_hours)
assert_equal 154.25, assigns(:total_hours)
# display all time based on what's been logged
assert_equal '2007-03-12'.to_date, assigns(:from)
assert_equal '2007-04-22'.to_date, assigns(:to)
# display all time
assert_nil assigns(:from)
assert_nil assigns(:to)
# TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes
# to use /issues/:issue_id/time_entries
assert_tag :form,
-48
View File
@@ -125,52 +125,4 @@ class TimeEntryTest < ActiveSupport::TestCase
:activity => activity)
assert_equal project.id, te.project.id
end
context "#earilest_date_for_project" do
setup do
User.current = nil
@public_project = Project.generate!(:is_public => true)
@issue = Issue.generate_for_project!(@public_project)
TimeEntry.generate!(:spent_on => '2010-01-01',
:issue => @issue,
:project => @public_project)
end
context "without a project" do
should "return the lowest spent_on value that is visible to the current user" do
assert_equal "2007-03-12", TimeEntry.earilest_date_for_project.to_s
end
end
context "with a project" do
should "return the lowest spent_on value that is visible to the current user for that project and it's subprojects only" do
assert_equal "2010-01-01", TimeEntry.earilest_date_for_project(@public_project).to_s
end
end
end
context "#latest_date_for_project" do
setup do
User.current = nil
@public_project = Project.generate!(:is_public => true)
@issue = Issue.generate_for_project!(@public_project)
TimeEntry.generate!(:spent_on => '2010-01-01',
:issue => @issue,
:project => @public_project)
end
context "without a project" do
should "return the highest spent_on value that is visible to the current user" do
assert_equal "2010-01-01", TimeEntry.latest_date_for_project.to_s
end
end
context "with a project" do
should "return the highest spent_on value that is visible to the current user for that project and it's subprojects only" do
project = Project.find(1)
assert_equal "2007-04-22", TimeEntry.latest_date_for_project(project).to_s
end
end
end
end