@@ -122,16 +122,20 module QueriesHelper | |||||
122 | end |
|
122 | end | |
123 | end |
|
123 | end | |
124 |
|
124 | |||
125 |
def csv_value(column, |
|
125 | def csv_value(column, object, value) | |
126 | format_object(value, false) do |value| |
|
126 | format_object(value, false) do |value| | |
127 | case value.class.name |
|
127 | case value.class.name | |
128 | when 'Float' |
|
128 | when 'Float' | |
129 | sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator)) |
|
129 | sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator)) | |
130 | when 'IssueRelation' |
|
130 | when 'IssueRelation' | |
131 |
other = value.other_issue( |
|
131 | other = value.other_issue(object) | |
132 |
l(value.label_for( |
|
132 | l(value.label_for(object)) + " ##{other.id}" | |
133 | when 'Issue' |
|
133 | when 'Issue' | |
134 | value.id |
|
134 | if object.is_a?(TimeEntry) | |
|
135 | "#{value.tracker} ##{value.id}: #{value.subject}" | |||
|
136 | else | |||
|
137 | value.id | |||
|
138 | end | |||
135 | else |
|
139 | else | |
136 | value |
|
140 | value | |
137 | end |
|
141 | end |
@@ -716,4 +716,14 class TimelogControllerTest < ActionController::TestCase | |||||
716 | assert_equal 'text/csv; header=present', response.content_type |
|
716 | assert_equal 'text/csv; header=present', response.content_type | |
717 | end |
|
717 | end | |
718 | end |
|
718 | end | |
|
719 | ||||
|
720 | def test_index_csv_should_fill_issue_column_with_tracker_id_and_subject | |||
|
721 | issue = Issue.find(1) | |||
|
722 | entry = TimeEntry.generate!(:issue => issue, :comments => "Issue column content test") | |||
|
723 | ||||
|
724 | get :index, :format => 'csv' | |||
|
725 | line = response.body.split("\n").detect {|l| l.include?(entry.comments)} | |||
|
726 | assert_not_nil line | |||
|
727 | assert_include "#{issue.tracker} #1: #{issue.subject}", line | |||
|
728 | end | |||
719 | end |
|
729 | end |
General Comments 0
You need to be logged in to leave comments.
Login now