Feature #36328 » parent-child-filter-inclusive.patch
| app/models/issue_query.rb | ||
|---|---|---|
| 605 | 605 |
else |
| 606 | 606 |
"1=0" |
| 607 | 607 |
end |
| 608 |
when "=+" |
|
| 609 |
ids = value.first.to_s.scan(/\d+/).map(&:to_i).uniq |
|
| 610 |
if ids.present? |
|
| 611 |
"(#{Issue.table_name}.parent_id IN (#{ids.join(",")}) OR #{Issue.table_name}.id IN (#{ids.join(",")}))"
|
|
| 612 |
else |
|
| 613 |
"1=0" |
|
| 614 |
end |
|
| 615 |
when "~+" |
|
| 616 |
root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first |
|
| 617 |
if root_id && lft && rgt |
|
| 618 |
"#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft >= #{lft} AND #{Issue.table_name}.rgt <= #{rgt}"
|
|
| 619 |
else |
|
| 620 |
"1=0" |
|
| 621 |
end |
|
| 608 | 622 |
when "!*" |
| 609 | 623 |
"#{Issue.table_name}.parent_id IS NULL"
|
| 610 | 624 |
when "*" |
| ... | ... | |
| 630 | 644 |
else |
| 631 | 645 |
"1=0" |
| 632 | 646 |
end |
| 647 |
when "=+" |
|
| 648 |
child_ids = value.first.to_s.scan(/\d+/).map(&:to_i).uniq |
|
| 649 |
ids = Issue.where(:id => child_ids).pluck(:parent_id).compact.uniq |
|
| 650 |
if child_ids.present? |
|
| 651 |
if ids.present? |
|
| 652 |
"(#{Issue.table_name}.id IN (#{ids.join(",")}) OR #{Issue.table_name}.id IN (#{child_ids.join(",")}))"
|
|
| 653 |
else |
|
| 654 |
"#{Issue.table_name}.id IN (#{child_ids.join(",")})"
|
|
| 655 |
end |
|
| 656 |
else |
|
| 657 |
"1=0" |
|
| 658 |
end |
|
| 659 |
when "~+" |
|
| 660 |
root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first |
|
| 661 |
if root_id && lft && rgt |
|
| 662 |
"#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft <= #{lft} AND #{Issue.table_name}.rgt >= #{rgt}"
|
|
| 663 |
else |
|
| 664 |
"1=0" |
|
| 665 |
end |
|
| 633 | 666 |
when "!*" |
| 634 | 667 |
"#{Issue.table_name}.rgt - #{Issue.table_name}.lft = 1"
|
| 635 | 668 |
when "*" |
| app/models/query.rb | ||
|---|---|---|
| 306 | 306 |
"!p" => :label_no_issues_in_project, |
| 307 | 307 |
"*o" => :label_any_open_issues, |
| 308 | 308 |
"!o" => :label_no_open_issues, |
| 309 |
"=+" => :label_equals_inclusive, |
|
| 310 |
"~+" => :label_contains_inclusive, |
|
| 309 | 311 |
} |
| 310 | 312 | |
| 311 | 313 |
class_attribute :operators_by_filter_type |
| ... | ... | |
| 321 | 323 |
:integer => [ "=", ">=", "<=", "><", "!*", "*" ], |
| 322 | 324 |
:float => [ "=", ">=", "<=", "><", "!*", "*" ], |
| 323 | 325 |
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"], |
| 324 |
:tree => ["=", "~", "!*", "*"] |
|
| 326 |
:tree => ["=", "~", "!*", "*", "=+", "~+"]
|
|
| 325 | 327 |
} |
| 326 | 328 | |
| 327 | 329 |
class_attribute :available_columns |
| config/locales/en.yml | ||
|---|---|---|
| 771 | 771 |
label_filter_add: Add filter |
| 772 | 772 |
label_filter_plural: Filters |
| 773 | 773 |
label_equals: is |
| 774 |
label_equals_inclusive: is (inclusive) |
|
| 774 | 775 |
label_not_equals: is not |
| 775 | 776 |
label_in_less_than: in less than |
| 776 | 777 |
label_in_more_than: in more than |
| ... | ... | |
| 797 | 798 |
label_more_than_ago: more than days ago |
| 798 | 799 |
label_ago: days ago |
| 799 | 800 |
label_contains: contains |
| 801 |
label_contains_inclusive: contains (inclusive) |
|
| 800 | 802 |
label_not_contains: doesn't contain |
| 801 | 803 |
label_starts_with: starts with |
| 802 | 804 |
label_ends_with: ends with |
| config/locales/it.yml | ||
|---|---|---|
| 426 | 426 |
label_filter_add: Aggiungi filtro |
| 427 | 427 |
label_filter_plural: Filtri |
| 428 | 428 |
label_equals: è |
| 429 |
label_equals_inclusive: è (incluso) |
|
| 429 | 430 |
label_not_equals: non è |
| 430 | 431 |
label_in_less_than: è minore di |
| 431 | 432 |
label_in_more_than: è maggiore di |
| ... | ... | |
| 436 | 437 |
label_more_than_ago: più di giorni fa |
| 437 | 438 |
label_ago: giorni fa |
| 438 | 439 |
label_contains: contiene |
| 440 |
label_contains_inclusive: contiene (incluso) |
|
| 439 | 441 |
label_not_contains: non contiene |
| 440 | 442 |
label_day_plural: giorni |
| 441 | 443 |
label_repository: Repository |