@@ -88,7 +88,7 class TimelogController < ApplicationController | |||||
88 | sql << " WHERE" |
|
88 | sql << " WHERE" | |
89 | sql << " (%s) AND" % @project.project_condition(Setting.display_subprojects_issues?) if @project |
|
89 | sql << " (%s) AND" % @project.project_condition(Setting.display_subprojects_issues?) if @project | |
90 | sql << " (%s) AND" % Project.allowed_to_condition(User.current, :view_time_entries) |
|
90 | sql << " (%s) AND" % Project.allowed_to_condition(User.current, :view_time_entries) | |
91 |
sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from |
|
91 | sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)] | |
92 | sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on" |
|
92 | sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on" | |
93 |
|
93 | |||
94 | @hours = ActiveRecord::Base.connection.select_all(sql) |
|
94 | @hours = ActiveRecord::Base.connection.select_all(sql) |
@@ -147,6 +147,14 class TimelogControllerTest < Test::Unit::TestCase | |||||
147 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
147 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
148 | end |
|
148 | end | |
149 |
|
149 | |||
|
150 | def test_report_one_day | |||
|
151 | get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"] | |||
|
152 | assert_response :success | |||
|
153 | assert_template 'report' | |||
|
154 | assert_not_nil assigns(:total_hours) | |||
|
155 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |||
|
156 | end | |||
|
157 | ||||
150 | def test_report_custom_field_criteria |
|
158 | def test_report_custom_field_criteria | |
151 | get :report, :project_id => 1, :criterias => ['project', 'cf_1'] |
|
159 | get :report, :project_id => 1, :criterias => ['project', 'cf_1'] | |
152 | assert_response :success |
|
160 | assert_response :success | |
@@ -238,6 +246,14 class TimelogControllerTest < Test::Unit::TestCase | |||||
238 | assert_equal Date.today - 7, assigns(:from) |
|
246 | assert_equal Date.today - 7, assigns(:from) | |
239 | assert_equal Date.today, assigns(:to) |
|
247 | assert_equal Date.today, assigns(:to) | |
240 | end |
|
248 | end | |
|
249 | ||||
|
250 | def test_details_one_day | |||
|
251 | get :details, :project_id => 1, :from => "2007-03-23", :to => "2007-03-23" | |||
|
252 | assert_response :success | |||
|
253 | assert_template 'details' | |||
|
254 | assert_not_nil assigns(:total_hours) | |||
|
255 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |||
|
256 | end | |||
241 |
|
257 | |||
242 | def test_details_at_issue_level |
|
258 | def test_details_at_issue_level | |
243 | get :details, :issue_id => 1 |
|
259 | get :details, :issue_id => 1 |
General Comments 0
You need to be logged in to leave comments.
Login now