Sha256: 7393b075e255b790fb32d7312cce7320f2611a6cb4eb8aadfa0c60b1f3d01782

Contents?: true

Size: 465 Bytes

Versions: 5

Compression:

Stored size: 465 Bytes

Contents

module ForemanTasks
  class Task::Summarizer
    def summarize_by_status(since = nil)
      result = ::ForemanTasks::Task.select('count(state) AS count, state, result').group(:state, :result).order(:state)
      result = result.where('started_at > ?', since) if since
      result
    end

    def latest_tasks_in_errors_warning(limit = 5)
      ::ForemanTasks::Task.where('result in (?)', %w[error warning]).order('started_at DESC').limit(limit)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman-tasks-0.9.6 app/models/foreman_tasks/task/summarizer.rb
foreman-tasks-0.9.5 app/models/foreman_tasks/task/summarizer.rb
foreman-tasks-0.10.0 app/models/foreman_tasks/task/summarizer.rb
foreman-tasks-0.9.4 app/models/foreman_tasks/task/summarizer.rb
foreman-tasks-0.9.3 app/models/foreman_tasks/task/summarizer.rb