Commit 7ed34ce0 authored by jplang's avatar jplang

Adds a scope to left join the issue.

git-svn-id: https://svn.redmine.org/redmine/trunk@16481 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent cb94f4a9
......@@ -54,6 +54,9 @@ class TimeEntry < ActiveRecord::Base
joins(:project).
where(TimeEntry.visible_condition(args.shift || User.current, *args))
}
scope :left_join_issue, lambda {
joins("LEFT OUTER JOIN #{Issue.table_name} ON #{Issue.table_name}.id = #{TimeEntry.table_name}.issue_id")
}
scope :on_issue, lambda {|issue|
joins(:issue).
where("#{Issue.table_name}.root_id = #{issue.root_id} AND #{Issue.table_name}.lft >= #{issue.lft} AND #{Issue.table_name}.rgt <= #{issue.rgt}")
......
......@@ -115,7 +115,7 @@ class TimeEntryQuery < Query
def base_scope
TimeEntry.visible.
joins(:project, :user).
joins("LEFT OUTER JOIN issues ON issues.id = time_entries.issue_id").
left_join_issue.
where(statement)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment