@@ -590,6 +590,23 class Query < ActiveRecord::Base | |||
|
590 | 590 | raise StatementInvalid.new(e.message) |
|
591 | 591 | end |
|
592 | 592 | |
|
593 | # Returns the issues ids | |
|
594 | def issue_ids(options={}) | |
|
595 | order_option = [group_by_sort_order, options[:order]].reject {|s| s.blank?}.join(',') | |
|
596 | order_option = nil if order_option.blank? | |
|
597 | ||
|
598 | joins = (order_option && order_option.include?('authors')) ? "LEFT OUTER JOIN users authors ON authors.id = #{Issue.table_name}.author_id" : nil | |
|
599 | ||
|
600 | Issue.visible.scoped(:conditions => options[:conditions]).find_ids :include => ([:status, :project] + (options[:include] || [])).uniq, | |
|
601 | :conditions => statement, | |
|
602 | :order => order_option, | |
|
603 | :joins => joins, | |
|
604 | :limit => options[:limit], | |
|
605 | :offset => options[:offset] | |
|
606 | rescue ::ActiveRecord::StatementInvalid => e | |
|
607 | raise StatementInvalid.new(e.message) | |
|
608 | end | |
|
609 | ||
|
593 | 610 | # Returns the journals |
|
594 | 611 | # Valid options are :order, :offset, :limit |
|
595 | 612 | def journals(options={}) |
@@ -738,9 +755,9 class Query < ActiveRecord::Base | |||
|
738 | 755 | end |
|
739 | 756 | end |
|
740 | 757 | when "o" |
|
741 |
sql = "#{IssueStatus.table_name} |
|
|
758 | sql = "#{Issue.table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})" if field == "status_id" | |
|
742 | 759 | when "c" |
|
743 |
sql = "#{IssueStatus.table_name} |
|
|
760 | sql = "#{Issue.table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})" if field == "status_id" | |
|
744 | 761 | when ">t-" |
|
745 | 762 | sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0) |
|
746 | 763 | when "<t-" |
General Comments 0
You need to be logged in to leave comments.
Login now