Class: Stats::Contexts

Inherits:
Object
  • Object
show all
Defined in:
app/models/stats/contexts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ Contexts

Returns a new instance of Contexts


5
6
7
# File 'app/models/stats/contexts.rb', line 5

def initialize(user)
  @user = user
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user


4
5
6
# File 'app/models/stats/contexts.rb', line 4

def user
  @user
end

Instance Method Details

#actionsObject


9
10
11
# File 'app/models/stats/contexts.rb', line 9

def actions
  @actions ||= Stats::TopContextsQuery.new(user, :limit => 5).result
end

#chartsObject


17
18
19
20
21
22
23
24
# File 'app/models/stats/contexts.rb', line 17

def charts
  @charts = %w{
    context_total_actions_data
    context_running_actions_data
  }.map do |action|
    Stats::Chart.new(action, :height => 325)
  end
end

#running_actionsObject


13
14
15
# File 'app/models/stats/contexts.rb', line 13

def running_actions
  @running_actions ||= Stats::TopContextsQuery.new(user, :limit => 5, :running => true).result
end