Permalink
Browse files

Fix last of nagging issues

  • Loading branch information...
gnufied committed Mar 1, 2012
1 parent 515e8af commit 312f08287e0a53a1748276b6e4407d27fa2d7912
Showing with 15 additions and 12 deletions.
  1. +1 −1 app/models/mapping.rb
  2. +1 −1 lib/issue_patch.rb
  3. +8 −4 lib/pivotal_story.rb
  4. +5 −6 lib/trackmine.rb
View
@@ -2,7 +2,7 @@ class Mapping < ActiveRecord::Base
unloadable
belongs_to :project
- validates_presence_of :project_id, :tracker_project_id, :estimations, :story_types, :status_type
+ validates_presence_of :project_id, :tracker_project_id, :estimations, :story_types
validates_uniqueness_of :tracker_project_id, :scope => :label
serialize :estimations
serialize :story_types
View
@@ -26,7 +26,7 @@ def self.included(klass) # :nodoc:
begin
puts "Pivotal project id is #{pivotal_project_id}"
if pivotal_project_id
- new PivotalStory(issue,pivotal_project_id))
+ PivotalStory.new(issue,pivotal_project_id)
end
puts "Creating pt story is done"
rescue => e
View
@@ -18,10 +18,14 @@ def initialize(issue, pivotal_project_id)
end
def story_type
- map_type = mapping.story_types.detect { |pt_type, mine_type| mine_type == issue.tracker.name }
- mapping[0]
- rescue
- 'feature'
+ case issue.tracker.name
+ when 'Todo', 'Feature'
+ 'feature'
+ when 'Defect', 'Bug'
+ 'bug'
+ else
+ 'chore'
+ end
end
def description
View
@@ -52,7 +52,7 @@ def read_activity(activity)
if story['current_state'] == "started"
story_restart(issues, activity)
else
- update_state(issue,activity)
+ issues.each {|issue| update_state(issue,story) }
end
story_url = get_story(activity).url
update_issues(issues, activity['project_id'], {:description => story_url +"\r\n"+ story['description']}) if story['description']
@@ -71,15 +71,14 @@ def get_user_email(project_id, name)
end
end
- def update_state(issue,story)
+ def update_state(issue, story)
case story['current_state']
- when 'finished'
+ when 'accepted'
finished_issue_state = IssueStatus.find_by_name "Closed"
- issue.update_attributes(:issue_id => finished_issue_state.id)
+ issue.update_attributes(:status_id => finished_issue_state.id)
else
finished_issue_state = IssueStatus.find_by_name "Review"
- issue.update_attributes(:issue_id => finished_issue_state.id)
- end
+ issue.update_attributes(:status_id => finished_issue_state.id)
end
end

0 comments on commit 312f082

Please sign in to comment.