添加为空判断
This commit is contained in:
parent
f1431b27fc
commit
dd06aa3a92
|
@ -492,25 +492,27 @@ class Query < ActiveRecord::Base
|
||||||
|
|
||||||
def project_statement
|
def project_statement
|
||||||
project_clauses = []
|
project_clauses = []
|
||||||
if project && !project.descendants.active.empty?
|
unless project.descendants.blank?
|
||||||
ids = [project.id]
|
if project && !project.descendants.active.empty?
|
||||||
if has_filter?("subproject_id")
|
ids = [project.id]
|
||||||
case operator_for("subproject_id")
|
if has_filter?("subproject_id")
|
||||||
when '='
|
case operator_for("subproject_id")
|
||||||
# include the selected subprojects
|
when '='
|
||||||
ids += values_for("subproject_id").each(&:to_i)
|
# include the selected subprojects
|
||||||
when '!*'
|
ids += values_for("subproject_id").each(&:to_i)
|
||||||
# main project only
|
when '!*'
|
||||||
else
|
# main project only
|
||||||
# all subprojects
|
else
|
||||||
|
# all subprojects
|
||||||
|
ids += project.descendants.collect(&:id)
|
||||||
|
end
|
||||||
|
elsif Setting.display_subprojects_issues?
|
||||||
ids += project.descendants.collect(&:id)
|
ids += project.descendants.collect(&:id)
|
||||||
end
|
end
|
||||||
elsif Setting.display_subprojects_issues?
|
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
||||||
ids += project.descendants.collect(&:id)
|
elsif project
|
||||||
|
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
||||||
end
|
end
|
||||||
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
|
||||||
elsif project
|
|
||||||
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
|
||||||
end
|
end
|
||||||
project_clauses.any? ? project_clauses.join(' AND ') : nil
|
project_clauses.any? ? project_clauses.join(' AND ') : nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue