From 37793896fc80297a3e2bee05eebfa3b29a1dffab Mon Sep 17 00:00:00 2001 From: Cesar Diaz Date: Fri, 4 Aug 2023 12:55:27 -0300 Subject: [PATCH] - refactor --- app/services/tool_filter_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/tool_filter_service.rb b/app/services/tool_filter_service.rb index e402d17bd..71c8546b1 100644 --- a/app/services/tool_filter_service.rb +++ b/app/services/tool_filter_service.rb @@ -42,10 +42,10 @@ def group_resources(tool_groups) def match_params(tool_group, params) if params.has_key?(:filter) - country = params["filter"]["country"]&.upcase if params["filter"]["country"].present? - languages = params["filter"]["language"] if params["filter"]["language"].present? - openness = params["filter"]["openness"].to_i if params["filter"]["openness"].present? - confidence = params["filter"]["confidence"].to_i if params["filter"]["confidence"].present? + country = params.dig("filter", "country")&.upcase + languages = params.dig("filter", "language") + openness = params.dig("filter", "openness")&.to_i + confidence = params.dig("filter", "confidence")&.to_i end if country.nil? & languages.nil? & openness.nil? & confidence.nil?