Skip to content

Commit c8a01d2

Browse files
committed
Change header to comply with existing documentation
1 parent b552391 commit c8a01d2

4 files changed

Lines changed: 19 additions & 23 deletions

File tree

app/services/exports/export_adjustments_csv_service.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def generate_csv_data
1919

2020
def headers
2121
[
22-
"Created", "Storage Location",
23-
"Comment", "User", "Changes"
22+
"Created date", "Storage Area",
23+
"Comment", "# of changes"
2424
] + item_names
2525
end
2626

@@ -33,7 +33,6 @@ def build_row(adjustment)
3333
adjustment.created_at.strftime("%F"),
3434
adjustment.storage_location.name,
3535
adjustment.comment,
36-
adjustment.user&.name || "Unknown",
3736
adjustment.line_items.count { |item| !item.quantity.eql?(0) }
3837
]
3938

docs/user_guide/bank/exports.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ The exports available include (in alphabetical order):
2727
Click "Inventory", then "Inventory Adjustments" in the left-hand menu. Then click "Export Adjustments",
2828

2929
### Contents of adjustment export
30-
Creation date, Organization, Storage Area, Comment, # of changes.
31-
32-
[! NOTE] We have improving the adjustments export to include the changes made in each adjustment on our todo list. We'll also remove the organization as redundant information. Please reach out if this is a priority for you.
30+
- Creation date
31+
- Storage Area, Comment
32+
- # of changes
33+
- the quantity of each of your organization's Items in the adjustments
3334

3435
## Annual Survey
3536
### Navigating to export annual survey

spec/controllers/adjustments_controller_spec.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@
4242

4343
it "includes appropriate headers for adjustments" do
4444
get :index, format: :csv
45-
expect(response.body).to include("Created")
46-
expect(response.body).to include("Storage Location")
45+
expect(response.body).to include("Created date")
46+
expect(response.body).to include("Storage Area")
4747
expect(response.body).to include("Comment")
48-
expect(response.body).to include("User")
49-
expect(response.body).to include("Changes")
48+
expect(response.body).to include("# of changes")
5049
expect(response.body).to include(item1.name)
5150
expect(response.body).to include(item2.name)
5251
end
@@ -62,10 +61,10 @@
6261

6362
expect(parsed_csv[0][item1.name]).to eq("10")
6463
expect(parsed_csv[0][item2.name]).to eq("5")
65-
expect(parsed_csv[0]["Changes"]).to eq("2")
64+
expect(parsed_csv[0]["# of changes"]).to eq("2")
6665

6766
expect(parsed_csv[1][item1.name]).to eq("-5")
68-
expect(parsed_csv[1]["Changes"]).to eq("1")
67+
expect(parsed_csv[1]["# of changes"]).to eq("1")
6968
end
7069

7170
context "when filtering by date" do

spec/services/exports/export_adjustments_csv_service_spec.rb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
RSpec.describe Exports::ExportAdjustmentsCSVService do
1+
RSpec.describe Exports::ExportAdjustmentsCSVService, :wip do
22
# Create organization after items to ensure proper associations
33
let!(:item1) { create(:item, name: 'item1') }
44
let!(:item2) { create(:item, name: 'item2') }
@@ -21,8 +21,8 @@
2121

2222
let(:expected_headers) do
2323
[
24-
"Created", "Storage Location",
25-
"Comment", "User", "Changes"
24+
"Created date", "Storage Area",
25+
"Comment", "# of changes"
2626
] + sorted_item_names
2727
end
2828

@@ -77,7 +77,6 @@
7777
adjustments[0].created_at.strftime("%F"),
7878
storage_location.name,
7979
"adjustment 1",
80-
user.name,
8180
2 # Number of items changed
8281
)
8382

@@ -86,7 +85,6 @@
8685
adjustments[1].created_at.strftime("%F"),
8786
storage_location.name,
8887
"adjustment 2",
89-
user.name,
9088
1 # Number of items changed
9189
)
9290

@@ -95,7 +93,6 @@
9593
adjustments[2].created_at.strftime("%F"),
9694
storage_location.name,
9795
"adjustment 3",
98-
user.name,
9996
1 # Number of items changed
10097
)
10198
end
@@ -131,7 +128,7 @@
131128
end
132129

133130
it "should correctly sum up the number of changes" do
134-
idx = expected_headers.index("Changes")
131+
idx = expected_headers.index("# of changes")
135132
expect(subject[1][idx]).to eq(2)
136133
expect(subject[2][idx]).to eq(1)
137134
expect(subject[3][idx]).to eq(1)
@@ -166,16 +163,16 @@
166163
it "generates valid CSV data" do
167164
expect(subject).to be_a(String)
168165
parsed_csv = CSV.parse(subject, headers: true)
169-
expect(parsed_csv.headers).to include("Created",
170-
"Storage Location",
166+
expect(parsed_csv.headers).to include("Created date",
167+
"Storage Area",
171168
"Comment",
172-
"Changes",
169+
"# of changes",
173170
item1.name,
174171
item2.name,
175172
item3.name,
176173
item4.name)
177174

178-
expect(parsed_csv.first["Changes"]).to eq("2")
175+
expect(parsed_csv.first["# of changes"]).to eq("2")
179176
expect(parsed_csv.first[item1.name]).to eq("111")
180177
expect(parsed_csv.first[item2.name]).to eq("-7")
181178
end

0 commit comments

Comments
 (0)