Patch #21611 » query_project_statement_2.diff
app/models/query.rb | ||
---|---|---|
567 | 567 |
def project_statement |
568 | 568 |
project_clauses = [] |
569 | 569 |
if project && !project.descendants.active.empty? |
570 |
ids = [project.id] |
|
571 | 570 |
if has_filter?("subproject_id") |
572 | 571 |
case operator_for("subproject_id") |
573 | 572 |
when '=' |
574 | 573 |
# include the selected subprojects |
575 |
ids += values_for("subproject_id").each(&:to_i) |
|
574 |
ids = [project.id] + values_for("subproject_id").each(&:to_i) |
|
575 |
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',') |
|
576 | 576 |
when '!*' |
577 | 577 |
# main project only |
578 |
project_clauses << "#{Project.table_name}.id = %d" % project.id |
|
578 | 579 |
else |
579 | 580 |
# all subprojects |
580 |
ids += project.descendants.collect(&:id)
|
|
581 |
project_clauses << "#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}"
|
|
581 | 582 |
end |
582 | 583 |
elsif Setting.display_subprojects_issues? |
583 |
ids += project.descendants.collect(&:id) |
|
584 |
project_clauses << "#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}" |
|
585 |
else |
|
586 |
project_clauses << "#{Project.table_name}.id = %d" % project.id |
|
584 | 587 |
end |
585 |
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',') |
|
586 | 588 |
elsif project |
587 | 589 |
project_clauses << "#{Project.table_name}.id = %d" % project.id |
588 | 590 |
end |
- « Previous
- 1
- 2
- Next »