summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-16 11:48:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-16 11:48:44 +0000
commite57b5ddbcc7d9f962fdc1679051eee5780643532 (patch)
treea92d9a86a5e89a281afed633c8bd29038d11c1a1
parent7e9805aa953e65deadbded802ec76cecac8f595f (diff)
downloadredmine-e57b5ddbcc7d9f962fdc1679051eee5780643532.tar.gz
redmine-e57b5ddbcc7d9f962fdc1679051eee5780643532.zip
Merged r16808 (#26387).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@16818 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/time_entry_query.rb6
-rw-r--r--test/functional/timelog_controller_test.rb14
2 files changed, 17 insertions, 3 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 35ff2df1d..ee15699f4 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -115,6 +115,8 @@ class TimeEntryQuery < Query
def base_scope
TimeEntry.visible.
joins(:project, :user).
+ includes(:activity).
+ references(:activity).
left_join_issue.
where(statement)
end
@@ -124,9 +126,7 @@ class TimeEntryQuery < Query
base_scope.
order(order_option).
- joins(joins_for_order_statement(order_option.join(','))).
- includes(:activity).
- references(:activity)
+ joins(joins_for_order_statement(order_option.join(',')))
end
# Returns sum of all the spent hours
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 1f8ad936d..89b1ccfcf 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -847,6 +847,20 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_equal [t3, t1, t2].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')}
end
+ def test_index_with_activity_filter
+ activity = TimeEntryActivity.create!(:name => 'Activity')
+ entry = TimeEntry.generate!(:issue_id => 1, :hours => 4.5, :activity => activity)
+
+ get :index, :params => {
+ :f => ['activity_id'],
+ :op => {'activity_id' => '='},
+ :v => {'activity_id' => [activity.id.to_s]}
+ }
+ assert_response :success
+ assert_select "tr#time-entry-#{entry.id}"
+ assert_select "table.time-entries tbody tr", 1
+ end
+
def test_index_with_issue_status_filter
Issue.where(:status_id => 4).update_all(:status_id => 2)
issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :status_id => 4)