projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '13939-unqualified-contents-orders'
[arvados.git]
/
services
/
api
/
lib
/
record_filters.rb
diff --git
a/services/api/lib/record_filters.rb
b/services/api/lib/record_filters.rb
index 900b784cd03283ba86540754cdd6324514800f1c..dc427c12c1f82cfc76d8b53a13ad1d7b8a88c032 100644
(file)
--- a/
services/api/lib/record_filters.rb
+++ b/
services/api/lib/record_filters.rb
@@
-66,8
+66,8
@@
module RecordFilters
col = model_class.columns.select { |c| c.name == subproperty[0] }.first
if subproperty.length == 2
col = model_class.columns.select { |c| c.name == subproperty[0] }.first
if subproperty.length == 2
- if col.type != :jsonb
- raise ArgumentError.new("Invalid attribute '#{subproperty[0]}' for
operator '#{operator}' in
filter")
+ if col.
nil? or col.
type != :jsonb
+ raise ArgumentError.new("Invalid attribute '#{subproperty[0]}' for
subproperty
filter")
end
if subproperty[1][0] == "<" and subproperty[1][-1] == ">"
end
if subproperty[1][0] == "<" and subproperty[1][-1] == ">"
@@
-109,10
+109,12
@@
module RecordFilters
"for '#{operator}' operator in filters")
end
when 'exists'
"for '#{operator}' operator in filters")
end
when 'exists'
- if operand
+ if operand
== true
cond_out << "jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)"
cond_out << "jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)"
- else
+ els
if operand == fals
e
cond_out << "(NOT jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)) OR #{ar_table_name}.#{subproperty[0]} is NULL"
cond_out << "(NOT jsonb_exists(#{ar_table_name}.#{subproperty[0]}, ?)) OR #{ar_table_name}.#{subproperty[0]} is NULL"
+ else
+ raise ArgumentError.new("Invalid operand '#{operand}' for '#{operator}' must be true or false")
end
param_out << subproperty[1]
else
end
param_out << subproperty[1]
else