Class: Artisan::StoryColumnChanger

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

Instance Method Summary collapse

Constructor Details

#initialize(story, user) ⇒ StoryColumnChanger

Returns a new instance of StoryColumnChanger.



7
8
9
10
# File 'lib/artisan/story_column_changer.rb', line 7

def initialize(story, user)
  @story = story
  @user = user
end

Instance Method Details

#move_to_backlogObject



12
13
14
15
16
17
18
19
20
# File 'lib/artisan/story_column_changer.rb', line 12

def move_to_backlog
  clear_completed
  clear_working

  story_repository.remove_from_iteration(@story)

  story_repository.save(@story)
  Artisan::Activity::StoryAuditor::backlogged(@story.id, @story.project.id, @user.id)
end

#move_to_completed(user, iteration, options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/artisan/story_column_changer.rb', line 42

def move_to_completed(user, iteration, options = {})
  story_repository.add_to_iteration(iteration, @story)
  @story.assigned_user ||= user

  @story.complete = true
  @story.completed_at = DateTime.now

  story_repository.save(@story)

  options[:event_mailer].completed_story(@story) if !options[:event_mailer].nil?
  Artisan::Activity::StoryAuditor::completed(@story.id, @story.project.id, @user.id)
end

#move_to_ready(iteration) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/artisan/story_column_changer.rb', line 22

def move_to_ready(iteration)
  clear_completed
  clear_working

  story_repository.add_to_iteration(iteration, @story)

  story_repository.save(@story)
  Artisan::Activity::StoryAuditor::readied(@story.id, @story.project.id, @user.id)
end

#move_to_working(user, iteration) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/artisan/story_column_changer.rb', line 32

def move_to_working(user, iteration)
  clear_completed

  story_repository.add_to_iteration(iteration, @story)
  @story.assigned_user ||= user

  story_repository.save(@story)
  Artisan::Activity::StoryAuditor::worked(@story.id, @story.project.id, @user.id)
end