From f3cfd05c59fc81a01464e72d13832f140e4a3008 Mon Sep 17 00:00:00 2001 From: James Antrobus Date: Sat, 25 Aug 2012 18:29:13 +0100 Subject: [PATCH] issue #4 updated Redmine issue description to include link to Redmine --- lib/rmt/redmine.rb | 12 +++++++++--- lib/rmt/trello.rb | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/rmt/redmine.rb b/lib/rmt/redmine.rb index 7554e7d..2e43c13 100644 --- a/lib/rmt/redmine.rb +++ b/lib/rmt/redmine.rb @@ -78,12 +78,11 @@ def parse_issues(response_body) { :id => get_value_of_text_child_node(issue_node, "id"), :subject => get_value_of_text_child_node(issue_node, "subject"), - :description => get_value_of_text_child_node(issue_node, "description"), + :description => get_issue_description(issue_node), :start_date => get_value_of_text_child_node(issue_node, "start_date"), :due_date => get_value_of_text_child_node(issue_node, "due_date"), :done_ratio => get_value_of_text_child_node(issue_node, "done_ratio"), - :estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"), - :description => get_value_of_text_child_node(issue_node, "description"), + :estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"), :created_on => get_value_of_text_child_node(issue_node, "created_on"), :updated_on => get_value_of_text_child_node(issue_node, "updated_on"), :tracker => get_attribute_of_child_node(issue_node, "tracker", :name), @@ -103,6 +102,13 @@ def get_value_of_text_child_node(node, child_node_name) end private :get_value_of_text_child_node + def get_issue_description(node) + issue_id = get_value_of_text_child_node(node, "id") + description = get_value_of_text_child_node(node, "description") || "" + "#{description} #{@base_url}/issues/#{issue_id}" + end + private :get_issue_description + # given an Ox xml node, find a child node by the specified child_node_name. The specified node # should have an attribute with the name specified by attr_name; this method returns the value # of that attribute. diff --git a/lib/rmt/trello.rb b/lib/rmt/trello.rb index 3849b90..66be77e 100644 --- a/lib/rmt/trello.rb +++ b/lib/rmt/trello.rb @@ -28,7 +28,7 @@ def create_card(properties) puts "Adding card: #{properties[:name]}" card = ::Trello::Card.create(:name => properties[:name], :list_id => properties[:list], - :description => sanitize_utf8(properties[:description] || "")) + :description => sanitize_utf8(properties[:description])) if properties[:color] card.add_label(properties[:color]) end