Sha256: 8108e26cc9f0fbc41c546c756056f7574775843a4e4ca638e4104265e4627d67

Contents?: true

Size: 690 Bytes

Versions: 10

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

module RailsExecution
  class DashboardsController < ::RailsExecution::BaseController

    def home
      @in_processing_count = ::RailsExecution::Task.processing.count
      @tasks_count = ::RailsExecution::Task.group(:status).count
    end

    def insights
      @tasks_by_week = ::RailsExecution::Task
        .where(created_at: 10.weeks.ago.beginning_of_day..Time.current)
        .group('YEAR(created_at)', 'WEEK(created_at)')
        .count
      respond_to(&:json)
    end

    private

    def show_insights_chart?
      ::RailsExecution::Task.exists?(created_at: 100.year.ago..1.weeks.ago)
    end
    helper_method :show_insights_chart?

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails_execution-0.1.12 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.11 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.10 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.9 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.8 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.7 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.5 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.4 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.2 app/controllers/rails_execution/dashboards_controller.rb
rails_execution-0.1.1 app/controllers/rails_execution/dashboards_controller.rb