From c10428cd2a9882d13e196c6c4f4537db0b040640 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Fri, 28 Jun 2019 08:55:27 +0200 Subject: [PATCH] Fix sorting buttons not applying params --- .../protocol_importers/protocols_io/v3/api_client.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/utilities/protocol_importers/protocols_io/v3/api_client.rb b/app/utilities/protocol_importers/protocols_io/v3/api_client.rb index 3ddb8c337..c8986e3a0 100644 --- a/app/utilities/protocol_importers/protocols_io/v3/api_client.rb +++ b/app/utilities/protocol_importers/protocols_io/v3/api_client.rb @@ -48,7 +48,9 @@ module ProtocolImporters query = CONSTANTS.dig(:endpoints, :protocols, :default_query_params) .merge(query_params.except(:sort_by)) - query = query.merge(sort_mappings[query_params[:sort_by].to_sym]) if sort_mappings[query_params[:sort_by]] + if sort_mappings[query_params[:sort_by]&.to_sym] + query = query.merge(sort_mappings[query_params[:sort_by].to_sym]) + end self.class.get('/protocols', query: query) end