Defect #8853 » subprojects_query_filter_fix.patch
| app/models/query.rb | ||
|---|---|---|
|
if has_filter?("subproject_id")
|
||
|
case operator_for("subproject_id")
|
||
|
when '='
|
||
|
# include the selected subprojects
|
||
|
ids += values_for("subproject_id").each(&:to_i)
|
||
|
# include the selected subprojects, but not the parent project.
|
||
|
ids = values_for("subproject_id").each(&:to_i)
|
||
|
when '!*'
|
||
|
# main project only
|
||
|
else
|
||
| config/locales/de.yml | ||
|---|---|---|
|
field_comments: Kommentar
|
||
|
field_url: URL
|
||
|
field_start_page: Hauptseite
|
||
|
field_subproject: Unterprojekt von
|
||
|
field_subproject: Unterprojekt
|
||
|
field_hours: Stunden
|
||
|
field_activity: Aktivität
|
||
|
field_spent_on: Datum
|
||
| test/unit/query_test.rb | ||
|---|---|---|
|
def assert_query_statement_includes(query, condition)
|
||
|
assert query.statement.include?(condition), "Query statement condition not found in: #{query.statement}"
|
||
|
end
|
||
|
def test_filter_subproject_should_not_include_parent_issues
|
||
|
User.current = User.find(1)
|
||
|
project = Project.find(1)
|
||
|
assert project.issues.any?
|
||
|
subproject = project.children.find(3)
|
||
|
assert subproject.issues.any?
|
||
|
query = Query.new(:name => '_',
|
||
|
:project => project,
|
||
|
:filters => { 'subproject_id' => {:operator => '=', :values => [3]}})
|
||
|
result = find_issues_with_query(query)
|
||
|
assert_not_nil result
|
||
|
assert_equal subproject.issues.size, result.size
|
||
|
result.each do |issue|
|
||
|
assert_equal 3, issue.project_id
|
||
|
end
|
||
|
User.current = nil
|
||
|
end
|
||
|
|
||
|
def assert_query_result(expected, query)
|
||
|
assert_nothing_raised do
|
||