Skip to content

Commit

Permalink
Finishing a chore or release marks it accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Dec 10, 2008
1 parent 64f1216 commit 2fc1dfd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/pickler/feature.rb
Expand Up @@ -66,9 +66,13 @@ def push
end

def finish
story.current_state = "finished" unless story.complete?
story.to_s = local_body if filename
story.save
if filename
story.finish
story.to_s = local_body
story.save
else
story.finish!
end
end

def id
Expand Down
16 changes: 15 additions & 1 deletion lib/pickler/tracker/story.rb
Expand Up @@ -25,14 +25,28 @@ def transition!(state)
raise Pickler::Tracker::Error, "Invalid state #{state}", caller unless STATES.include?(state)
self.current_state = state
if id
xml = "<story><current-state>#{state}</current-state></story>"
xml = "<story><current_state>#{state}</current_state></story>"
error = tracker.request_xml(:put, resource_url, xml).fetch("errors",{})["error"] || true
else
error = save
end
raise Pickler::Tracker::Error, Array(error).join("\n"), caller unless error == true
end

def finish
case story_type
when "bug", "feature"
self.current_state = "finished" unless complete?
when "chore", "release"
self.current_state = "accepted"
end
current_state
end

def finish!
transition!(finish)
end

def backlog?(as_of = Date.today)
iteration && iteration.start >= as_of
end
Expand Down

0 comments on commit 2fc1dfd

Please sign in to comment.