Class: Artisan::Iterations::IterationWorkflowInteractor
- Inherits:
-
Object
- Object
- Artisan::Iterations::IterationWorkflowInteractor
- Defined in:
- lib/artisan/iterations/iteration_workflow_interactor.rb
Instance Attribute Summary collapse
-
#iteration ⇒ Object
Returns the value of attribute iteration.
-
#project ⇒ Object
Returns the value of attribute project.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #complete ⇒ Object
-
#initialize(iteration_id, user, iteration_repository = Repository.iteration) ⇒ IterationWorkflowInteractor
constructor
A new instance of IterationWorkflowInteractor.
- #resume ⇒ Object
- #start ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(iteration_id, user, iteration_repository = Repository.iteration) ⇒ IterationWorkflowInteractor
Returns a new instance of IterationWorkflowInteractor.
15 16 17 18 19 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 15 def initialize(iteration_id, user, iteration_repository = Repository.iteration) self.iteration = iteration_repository.find(iteration_id) self.project = iteration.project self.user = user end |
Instance Attribute Details
#iteration ⇒ Object
Returns the value of attribute iteration.
13 14 15 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 13 def iteration @iteration end |
#project ⇒ Object
Returns the value of attribute project.
13 14 15 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 13 def project @project end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 13 def user @user end |
Instance Method Details
#complete ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 21 def complete iteration.update_attributes!(:committed_points_at_completion => total_points) iteration.update_attributes!(:complete => true, :completed_at => Time.now) Activity::IterationAuditor.completed(iteration.id, iteration.project.id, user.id) MoveToBacklog.new(iteration).move # # Artisan::Stories.for(project.id, user).backlog.each do |story| # story.position += 1 if story.position # Artisan::Repository.story.save(story) # end return IterationWorkflowPresenter.new(iteration.id, iteration.project.id) end |
#resume ⇒ Object
36 37 38 39 40 41 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 36 def resume iteration.update_attributes!(:committed_points_at_completion => nil) iteration.update_attributes!(:complete => false, :completed_at => nil) Activity::IterationAuditor.resumed(iteration.id, iteration.project.id, user.id) return IterationWorkflowPresenter.new(iteration.id, iteration.project.id) end |
#start ⇒ Object
43 44 45 46 47 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 43 def start iteration.update_attributes!(:committed_points => total_points) Activity::IterationAuditor.started(iteration.id, iteration.project.id, user.id) return IterationWorkflowPresenter.new(iteration.id, iteration.project.id) end |
#state ⇒ Object
49 50 51 52 53 |
# File 'lib/artisan/iterations/iteration_workflow_interactor.rb', line 49 def state return :completed if iteration.complete? return :working if !iteration.committed_points.nil? return :planning end |