Class: Artisan::Projects::ProjectsPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/artisan/projects/projects_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ ProjectsPresenter

Returns a new instance of ProjectsPresenter.



8
9
10
# File 'lib/artisan/projects/projects_presenter.rb', line 8

def initialize(user)
  @user = user
end

Instance Method Details

#active_pointsObject



26
27
28
# File 'lib/artisan/projects/projects_presenter.rb', line 26

def active_points
  Stories::StoryCollection.new(active_stories).estimated_points
end

#active_stories_by_projectObject



22
23
24
# File 'lib/artisan/projects/projects_presenter.rb', line 22

def active_stories_by_project
  active_stories.group_by(&:project)
end

#archivedObject

TODO - PWP - optimize this method to use sql to create the returns rather than ruby



13
14
15
# File 'lib/artisan/projects/projects_presenter.rb', line 13

def archived
  read_attributes_to_hash(@user.projects.archived)
end

#currentObject

TODO - PWP - optimize this method to use sql to create the returns rather than ruby



18
19
20
# File 'lib/artisan/projects/projects_presenter.rb', line 18

def current
  read_attributes_to_hash(@user.projects.unarchived)
end