Skip to content

Commit

Permalink
Merge pull request #2268 from UKGovernmentBEIS/2997-the-filename-of-t…
Browse files Browse the repository at this point in the history
…he-csv-report

(2997) Include ODA type in ISPF report export filenames
  • Loading branch information
CristinaRO committed Nov 30, 2023
2 parents 4d63252 + c733821 commit d843137
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
included in the IATI XML download as applicable
- The error summary is now shown correctly when adding new matched effort in the
application
- The filenames for ISPF report CSVs now include the ODA type

## Release 140 - 2023-11-28

Expand Down
1 change: 1 addition & 0 deletions app/services/export/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def filename
[
@report.own_financial_quarter,
@report.fund.source_fund.short_name,
@report.is_oda.nil? ? nil : I18n.t(".is_oda_summary.#{@report.is_oda}"),
@report.organisation.beis_organisation_reference,
"report.csv"
].reject(&:blank?).join("_")
Expand Down
9 changes: 9 additions & 0 deletions spec/services/export/report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,21 @@

describe "#filename" do
subject { described_class.new(report: @report) }

it "creates the file name" do
expect(subject.filename).to include(@report.own_financial_quarter.to_s)
expect(subject.filename).to include(@report.fund.source_fund.short_name)
expect(subject.filename).to include(@report.organisation.beis_organisation_reference)
expect(subject.filename).to include("report.csv")
end

context "for an ISPF report" do
subject { described_class.new(report: build(:report, :for_ispf, is_oda: false)) }

it "includes the ODA/non-ODA type in the file name" do
expect(subject.filename).to include("ISPF_Non-ODA")
end
end
end

describe "@activity_attributes" do
Expand Down

0 comments on commit d843137

Please sign in to comment.