Class: Artisan::Iterations::MoveToBacklog

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

Instance Method Summary collapse

Constructor Details

#initialize(iteration) ⇒ MoveToBacklog

Returns a new instance of MoveToBacklog.



6
7
8
# File 'lib/artisan/iterations/move_to_backlog.rb', line 6

def initialize(iteration)
  @iteration = iteration
end

Instance Method Details

#incomplete_storiesObject



24
25
26
# File 'lib/artisan/iterations/move_to_backlog.rb', line 24

def incomplete_stories
  return @iteration.stories.select {|story| !story.complete?}
end

#moveObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/artisan/iterations/move_to_backlog.rb', line 10

def move
  incomplete_stories.each do |incomplete_story|
    incomplete_story.iteration = nil
    incomplete_story.position = 0
    Artisan::Repository.story.save(incomplete_story)
  end

  Artisan::Stories.for(@iteration.project.id).backlog.each do |story|
    story.position += 1 if story.position
    Artisan::Repository.story.save(story)
  end
end