mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 15:50:13 +01:00
Encapsulate counts and totals into a class.
Move queries out of the view and into the model layer.
This commit is contained in:
parent
6ccb9a81fb
commit
615a9e46c9
4 changed files with 106 additions and 22 deletions
|
|
@ -7,13 +7,9 @@ class StatsController < ApplicationController
|
|||
|
||||
def index
|
||||
@page_title = t('stats.index_title')
|
||||
|
||||
@first_action = current_user.todos.reorder("created_at ASC").first
|
||||
tag_ids = Stats::UserTagsQuery.new(current_user).result.map(&:id)
|
||||
@tags_count = tag_ids.size
|
||||
@unique_tags_count = tag_ids.uniq.size
|
||||
@hidden_contexts = current_user.contexts.hidden
|
||||
@actions = Stats::Actions.new(current_user)
|
||||
@totals = Stats::Totals.new(current_user)
|
||||
@projects = Stats::Projects.new(current_user)
|
||||
@contexts = Stats::Contexts.new(current_user)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue