diff --git a/app/charts/good_job/performance_index_chart.rb b/app/charts/good_job/performance_index_chart.rb index 3d891cbc..68aa422c 100644 --- a/app/charts/good_job/performance_index_chart.rb +++ b/app/charts/good_job/performance_index_chart.rb @@ -5,7 +5,7 @@ class PerformanceIndexChart < BaseChart def data table_name = GoodJob::Execution.table_name - sum_query = Arel.sql(GoodJob::Job.pg_or_jdbc_query(<<~SQL.squish)) + sum_query = <<~SQL.squish SELECT * FROM generate_series( date_trunc('hour', $1::timestamp), diff --git a/app/charts/good_job/performance_show_chart.rb b/app/charts/good_job/performance_show_chart.rb index 08c8f82e..e46ae098 100644 --- a/app/charts/good_job/performance_show_chart.rb +++ b/app/charts/good_job/performance_show_chart.rb @@ -21,7 +21,7 @@ def data table_name = GoodJob::Execution.table_name interval_entries = BUCKET_INTERVALS.map { "interval '#{_1}'" }.join(",") - sum_query = Arel.sql(GoodJob::Job.pg_or_jdbc_query(<<~SQL.squish)) + sum_query = <<~SQL.squish SELECT WIDTH_BUCKET(duration, ARRAY[#{interval_entries}]) as bucket_index, COUNT(WIDTH_BUCKET(duration, ARRAY[#{interval_entries}])) AS count diff --git a/app/charts/good_job/scheduled_by_queue_chart.rb b/app/charts/good_job/scheduled_by_queue_chart.rb index 7f5c21b2..bcff9da2 100644 --- a/app/charts/good_job/scheduled_by_queue_chart.rb +++ b/app/charts/good_job/scheduled_by_queue_chart.rb @@ -8,9 +8,7 @@ def initialize(filter) end def data - table_name = GoodJob::Job.table_name - - count_query = Arel.sql(GoodJob::Job.pg_or_jdbc_query(<<~SQL.squish)) + count_query = <<~SQL.squish SELECT * FROM generate_series( date_trunc('hour', $1::timestamp), @@ -23,7 +21,7 @@ def data queue_name, count(*) AS count FROM ( - #{@filter.filtered_query.except(:select, :order).select('queue_name', "COALESCE(#{table_name}.scheduled_at, #{table_name}.created_at)::timestamp AS scheduled_at").to_sql} + #{@filter.filtered_query.except(:select, :order).select(:queue_name, :scheduled_at).to_sql} ) sources GROUP BY date_trunc('hour', scheduled_at), queue_name ) sources ON sources.scheduled_at = timestamp