Skip to content

Commit d7924c0

Browse files
anna-devKagemaru
authored andcommitted
Add position name to accounting post csv (64412)
1 parent 411a3ed commit d7924c0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/controllers/concerns/cockpit_csv.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ def send_cockpit_csv(cockpit, filename)
1919

2020
def cockpit_csv(cockpit)
2121
CSV.generate do |csv|
22-
csv << ['Position', 'Budget', 'Geleistete Stunden', 'Nicht verrechenbar', 'Offenes Budget', 'Geplantes Budget']
22+
csv << ['Position', 'Name der Position', 'Budget', 'Geleistete Stunden', 'Nicht verrechenbar', 'Offenes Budget', 'Geplantes Budget']
2323
cockpit.rows.each do |row|
2424
csv << [row.respond_to?(:shortnames) ? row.shortnames : 'Total',
25+
row.respond_to?(:name) ? row.name : '',
2526
row.cells[:budget].hours,
2627
row.cells[:supplied_services].hours,
2728
row.cells[:not_billable].hours,

test/controllers/accounting_posts_controller_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ class AccountingPostsControllerTest < ActionController::TestCase
348348
assert_match expected_csv_header, csv_header
349349

350350
assert_equal 1, csv_data_lines.size
351-
assert_match 'PITC-PT,100.0,18.0,10.0,92.0,0', csv_data_lines.first
351+
assert_match 'PITC-PT,PuzzleTime,100.0,18.0,10.0,92.0,0', csv_data_lines.first
352352
end
353353

354354
test 'GET export csv with timespan' do
@@ -357,7 +357,7 @@ class AccountingPostsControllerTest < ActionController::TestCase
357357
assert_match expected_csv_header, csv_header
358358

359359
assert_equal 1, csv_data_lines.size
360-
assert_match 'PITC-PT,100.0,6.0,0,92.0,0', csv_data_lines.first
360+
assert_match 'PITC-PT,PuzzleTime,100.0,6.0,0,92.0,0', csv_data_lines.first
361361
end
362362

363363
test 'GET export csv with timespan including non-billable' do
@@ -366,13 +366,13 @@ class AccountingPostsControllerTest < ActionController::TestCase
366366
assert_match expected_csv_header, csv_header
367367

368368
assert_equal 1, csv_data_lines.size
369-
assert_match 'PITC-PT,100.0,16.0,10.0,92.0,0', csv_data_lines.first
369+
assert_match 'PITC-PT,PuzzleTime,100.0,16.0,10.0,92.0,0', csv_data_lines.first
370370
end
371371

372372
private
373373

374374
def expected_csv_header
375-
'Position,Budget,Geleistete Stunden,Nicht verrechenbar,Offenes Budget,Geplantes Budget'
375+
'Position,Name der Position,Budget,Geleistete Stunden,Nicht verrechenbar,Offenes Budget,Geplantes Budget'
376376
end
377377

378378
def csv_header

0 commit comments

Comments
 (0)