Skip to content

Commit

Permalink
fix(query): allow user using context variables into query (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthv authored Jun 7, 2024
1 parent f186b1c commit 3020a78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/forest_liana/query_stat_getter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def initialize(params)
end

def perform
raw_query = @params['query'].strip
context_variables = Utils::ContextVariables.new(nil, nil, @params['contextVariables'])
raw_query = Utils::ContextVariablesInjector.inject_context_in_value(@params['query'].strip, context_variables)

LiveQueryChecker.new(raw_query, 'Live Query Chart').validate()

if @params['record_id']
raw_query.gsub!('?', @params['record_id'].to_s)
end

result = ActiveRecord::Base.connection.execute(raw_query)

case @params['type']
Expand Down

0 comments on commit 3020a78

Please sign in to comment.