Fix sorting buttons not applying params

This commit is contained in:
Jure Grabnar 2019-06-28 08:55:27 +02:00
parent 1a9fca87d2
commit c10428cd2a

View file

@ -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