@@ -6,10 +6,43 @@ def redmine_gtt_print_issue_to_json(context)
6
6
issue = context [ :issue ]
7
7
json = context [ :json ]
8
8
attributes = json [ :attributes ] ||= { }
9
+
9
10
attributes [ :supply_items ] = IssueSupplyItemsPresenter . ( issue . issue_supply_items ) . join ( "\r \n " )
11
+ supply_items = IssueSupplyItemsPresenter . ( issue . issue_supply_items )
12
+ if supply_items . size > 5
13
+ attributes [ :supply_items_1 ] = supply_items [ 0 ..4 ] . join ( "\r \n " )
14
+ attributes [ :supply_items_2 ] = supply_items [ 5 ..-1 ] . join ( "\r \n " )
15
+ else
16
+ attributes [ :supply_items_1 ] = supply_items . join ( "\r \n " )
17
+ attributes [ :supply_items_2 ] = ""
18
+ end
10
19
items_by_type = issue . resource_items_by_type
11
- attributes [ :asset_resource_items ] = ResourceItemsPresenter . ( items_by_type [ 'asset' ] ) . join ( "\r \n " )
12
- attributes [ :human_resource_items ] = ResourceItemsPresenter . ( items_by_type [ 'human' ] ) . join ( "\r \n " )
20
+ asset_resource_items_value = ""
21
+ ResourceItemsPresenter . ( items_by_type [ 'asset' ] ) . each_with_index { |item , idx |
22
+ if idx == 0
23
+ asset_resource_items_value = item
24
+ else
25
+ if idx % 2 != 0
26
+ asset_resource_items_value += " " + item
27
+ else
28
+ asset_resource_items_value += "\r \n " + item
29
+ end
30
+ end
31
+ }
32
+ attributes [ :asset_resource_items ] = asset_resource_items_value
33
+ human_resource_items_value = ""
34
+ ResourceItemsPresenter . ( items_by_type [ 'human' ] ) . each_with_index { |item , idx |
35
+ if idx == 0
36
+ human_resource_items_value = item
37
+ else
38
+ if idx % 5 != 0
39
+ human_resource_items_value += " " + item
40
+ else
41
+ human_resource_items_value += "\r \n " + item
42
+ end
43
+ end
44
+ }
45
+ attributes [ :human_resource_items ] = human_resource_items_value
13
46
end
14
47
end
15
48
end
0 commit comments