Sha256: 3ec2501dbcdf8f12d0f60914bc6f287e7d3cc891c16eb57dfcb366281d67ea02

Contents?: true

Size: 805 Bytes

Versions: 23

Compression:

Stored size: 805 Bytes

Contents

module Logical
  module Naf
    module JobStatuses
      class Running

        def self.all(status = :running, conditions)
          if status == :queued
            order = "created_at"
            direction = "desc"
          else
            order = "started_at"
            direction = "desc"
          end
          <<-SQL
            (
              SELECT
                j.*, null AS "historical_job_id"
              FROM
                "#{::Naf.schema_name}"."historical_jobs" AS j
              WHERE
                j.started_at IS NOT NULL AND
                j.finished_at IS NULL AND
                j.request_to_terminate = false
              #{conditions}
              ORDER BY
                #{order} #{direction}
            )
          SQL
        end

      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-1.1.2 app/models/logical/naf/job_statuses/running.rb
naf-1.1.1 app/models/logical/naf/job_statuses/running.rb
naf-1.1.0 app/models/logical/naf/job_statuses/running.rb