Skip to content

Commit 3020a78

Browse files
authored
fix(query): allow user using context variables into query (#679)
1 parent f186b1c commit 3020a78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/services/forest_liana/query_stat_getter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ def initialize(params)
1313
end
1414

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

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

2021
if @params['record_id']
2122
raw_query.gsub!('?', @params['record_id'].to_s)
2223
end
23-
2424
result = ActiveRecord::Base.connection.execute(raw_query)
2525

2626
case @params['type']

0 commit comments

Comments
 (0)