Sha256: 370109b505433eae7df52925f381c201c24083794f76ad8b5ef4a5b3105bdcff

Contents?: true

Size: 994 Bytes

Versions: 8

Compression:

Stored size: 994 Bytes

Contents

module Admin
  class RunningResultsController < BaseController

    RUNNING_RESULTS = <<-SQL
      SELECT
        title query_title,
        compiled_body query_body,
        TO_CHAR(results.started_at, 'YYYY-MM-DD HH24:MI:SS') started_at,
        ROUND(EXTRACT(EPOCH FROM (now() - results.started_at)::INTERVAL)) duration_seconds,
        users.name author,
        users.role author_role,
        queries.id query_id,
        query_versions.id AS query_version_id,
        version
      FROM results
        LEFT OUTER JOIN query_versions ON query_versions.id = results.query_version_id
        LEFT OUTER JOIN queries ON query_versions.query_id = queries.id
        INNER JOIN users ON results.owner_id = users.id
      WHERE results.status = 'running'
    SQL

    respond_to :json

    def index
      respond_to do |format|
        format.html
        format.json do
          render json: ActiveRecord::Base.connection.exec_query(RUNNING_RESULTS)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev app/controllers/admin/running_results_controller.rb
aleph_analytics-0.4.8 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.4.7 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.4.4 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.4.2 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.4.1 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.3.0 app/controllers/admin/running_results_controller.rb
aleph_analytics-0.2.0 app/controllers/admin/running_results_controller.rb