mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Fix advanced filters for numbers [SCI-6577] (#3899)
This commit is contained in:
parent
493c7d64eb
commit
cc96a7e372
1 changed files with 7 additions and 7 deletions
|
@ -26,20 +26,20 @@ class RepositoryNumberValue < ApplicationRecord
|
|||
|
||||
case filter_element.operator
|
||||
when 'equal_to'
|
||||
repository_rows.where("#{join_alias}.data = ?", parameters['number'].to_i)
|
||||
repository_rows.where("#{join_alias}.data = ?", parameters['number'].to_d)
|
||||
when 'unequal_to'
|
||||
repository_rows.where.not("#{join_alias}.data = ?", parameters['number'].to_i)
|
||||
repository_rows.where.not("#{join_alias}.data = ?", parameters['number'].to_d)
|
||||
when 'greater_than'
|
||||
repository_rows.where("#{join_alias}.data > ?", parameters['number'].to_i)
|
||||
repository_rows.where("#{join_alias}.data > ?", parameters['number'].to_d)
|
||||
when 'greater_than_or_equal_to'
|
||||
repository_rows.where("#{join_alias}.data >= ?", parameters['number'].to_i)
|
||||
repository_rows.where("#{join_alias}.data >= ?", parameters['number'].to_d)
|
||||
when 'less_than'
|
||||
repository_rows.where("#{join_alias}.data < ?", parameters['number'].to_i)
|
||||
repository_rows.where("#{join_alias}.data < ?", parameters['number'].to_d)
|
||||
when 'less_than_or_equal_to'
|
||||
repository_rows.where("#{join_alias}.data <= ?", parameters['number'].to_i)
|
||||
repository_rows.where("#{join_alias}.data <= ?", parameters['number'].to_d)
|
||||
when 'between'
|
||||
repository_rows
|
||||
.where("#{join_alias}.data > ? AND #{join_alias}.data < ?", parameters['from'].to_i, parameters['to'].to_i)
|
||||
.where("#{join_alias}.data > ? AND #{join_alias}.data < ?", parameters['from'].to_d, parameters['to'].to_d)
|
||||
else
|
||||
raise ArgumentError, 'Wrong operator for RepositoryNumberValue!'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue