From cc96a7e372b8f75cd1ac0f9773488bf2042ab305 Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Mon, 28 Feb 2022 10:31:42 +0100 Subject: [PATCH] Fix advanced filters for numbers [SCI-6577] (#3899) --- app/models/repository_number_value.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/repository_number_value.rb b/app/models/repository_number_value.rb index 285d5d121..58a437589 100644 --- a/app/models/repository_number_value.rb +++ b/app/models/repository_number_value.rb @@ -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