Skip to content

Commit

Permalink
Fix last of nagging issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Mar 1, 2012
1 parent 515e8af commit 312f082
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/models/mapping.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/issue_patch.rb
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions lib/pivotal_story.rb
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions lib/trackmine.rb
Expand Up @@ -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']
Expand All @@ -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

Expand Down

0 comments on commit 312f082

Please sign in to comment.