7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/raif/admin/stats/tasks_controller.rb', line 7
def index
@selected_period = params[:period] || "day"
@time_range = get_time_range(@selected_period)
@task_count = Raif::Task.where(created_at: @time_range).count
@task_counts_by_type = Raif::Task.where(created_at: @time_range).group(:type).count
@task_costs_by_type = Raif::Task.joins(:raif_model_completion)
.where(created_at: @time_range)
.group(:type)
.sum("raif_model_completions.total_cost")
end
|