359 |
359 |
raise StatementInvalid.new(e.message)
|
360 |
360 |
end
|
361 |
361 |
|
|
362 |
def versions_for_id(options={})
|
|
363 |
Version.visible.
|
|
364 |
where(project_statement).
|
|
365 |
where(options[:conditions]).
|
|
366 |
includes(:project).
|
|
367 |
references(:project)
|
|
368 |
rescue ::ActiveRecord::StatementInvalid => e
|
|
369 |
raise StatementInvalid.new(e.message)
|
|
370 |
end
|
362 |
371 |
def sql_for_updated_by_field(field, operator, value)
|
363 |
372 |
neg = (operator == '!' ? 'NOT' : '')
|
364 |
373 |
subquery = "SELECT 1 FROM #{Journal.table_name}" +
|
... | ... | |
426 |
435 |
|
427 |
436 |
def sql_for_fixed_version_status_field(field, operator, value)
|
428 |
437 |
where = sql_for_field(field, operator, value, Version.table_name, "status")
|
429 |
|
version_ids = versions(:conditions => [where]).map(&:id)
|
430 |
|
|
|
438 |
#version_ids = versions(:conditions => [where]).map(&:id)
|
|
439 |
version_ids = versions_for_id(:conditions => [where]).pluck(:id)
|
431 |
440 |
nl = operator == "!" ? "#{Issue.table_name}.fixed_version_id IS NULL OR" : ''
|
432 |
441 |
"(#{nl} #{sql_for_field("fixed_version_id", "=", version_ids, Issue.table_name, "fixed_version_id")})"
|
433 |
442 |
end
|
434 |
443 |
|
435 |
444 |
def sql_for_fixed_version_due_date_field(field, operator, value)
|
436 |
445 |
where = sql_for_field(field, operator, value, Version.table_name, "effective_date")
|
437 |
|
version_ids = versions(:conditions => [where]).map(&:id)
|
438 |
|
|
|
446 |
#version_ids = versions(:conditions => [where]).map(&:id)
|
|
447 |
version_ids = versions_for_id(:conditions => [where]).pluck(:id)
|
439 |
448 |
nl = operator == "!*" ? "#{Issue.table_name}.fixed_version_id IS NULL OR" : ''
|
440 |
449 |
"(#{nl} #{sql_for_field("fixed_version_id", "=", version_ids, Issue.table_name, "fixed_version_id")})"
|
441 |
450 |
end
|