Project

General

Profile

Feature #2954 ยป redmine.duplicates.filter.patch

Nick Waggy, 2010-05-19 20:41

View differences:

config/locales/en.yml (working copy)
field_content: Content
field_group_by: Group results by
field_sharing: Sharing
field_relations_from: Duplicated by
setting_app_title: Application title
setting_app_subtitle: Application subtitle
app/models/query.rb (working copy)
if User.current.logged?
@available_filters["watcher_id"] = { :type => :list, :order => 15, :values => [["<< #{l(:label_me)} >>", "me"]] }
end
# filter out duplicates
@available_filters["relations_from"] = { :type => :list, :order => 14, :values => [ ["none", "none"] ] }
if project
# project specific filters
unless @project.issue_categories.empty?
......
db_field = 'user_id'
sql << "#{Issue.table_name}.id #{ operator == '=' ? 'IN' : 'NOT IN' } (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND "
sql << sql_for_field(field, '=', v, db_table, db_field) + ')'
elsif field == 'relations_from'
# filter out duplicates
db_table = IssueRelation.table_name
db_field = 'issue_from_id'
sql << "#{Issue.table_name}.id NOT IN (SELECT #{db_table}.issue_from_id from #{db_table} where relation_type='duplicates')"
else
# regular field
db_table = Issue.table_name
    (1-1/1)