Skip to content

Commit

Permalink
Add the Published on IATI value to the report csv
Browse files Browse the repository at this point in the history
This adds the new Export::ActivityIatiColumn to the report csv export.
  • Loading branch information
mec committed Nov 28, 2023
1 parent 4c20532 commit a101beb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
- Update documentation to reflect various new processes on the new DSIT AWS infrastructure
- The report export now includes a column for the Original Commitment value of
the activity, if one is available
- The report export now includes a column for the Published to IATI value, which
will either be yes or no

## Release 139 - 2023-11-14

Expand Down
7 changes: 7 additions & 0 deletions app/services/export/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def initialize(report:)
)
@tags_column = Export::ActivityTagsColumn.new(activities: activities) if @report.for_ispf?
@link_column = Export::ActivityLinkColumn.new(activities: activities)
@iati_column = Export::ActivityIatiColumn.new(activities: activities)
end

def headers
Expand All @@ -48,6 +49,7 @@ def headers
headers << @comments_column.headers
headers << @tags_column.headers if @report.for_ispf?
headers << @link_column.headers
headers << @iati_column.headers
headers.flatten
end

Expand All @@ -65,6 +67,7 @@ def rows
row << comment_rows.fetch(activity.id, nil)
row << tags_rows.fetch(activity.id, nil) if @report.for_ispf?
row << link_rows.fetch(activity.id, nil)
row << iati_rows.fetch(activity.id, nil)
row.flatten
end
end
Expand Down Expand Up @@ -124,6 +127,10 @@ def link_rows
@_link_rows ||= @link_column.rows
end

def iati_rows
@_iati_rows ||= @iati_column.rows
end

def activities
@activities ||= Activity::ProjectsForReportFinder.new(
report: @report,
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 @@ -134,6 +134,7 @@
expect(headers.to_s).to_not include("Forecast")
expect(headers).to include("Comments in report")
expect(headers).to include("Link to activity")
expect(headers).to include("Published on IATI")
end
end

Expand All @@ -153,6 +154,8 @@
.to eql @actual_spend_for_report_without_forecasts.value
expect(value_for_column("Total Actuals", row))
.to eql @actual_spend_for_report_without_forecasts.value
expect(value_for_column("Published on IATI", row))
.to eql "Yes"
end
end
end
Expand Down Expand Up @@ -214,6 +217,7 @@
expect(headers).to include("Forecast #{@report_without_actuals.own_financial_quarter}")
expect(headers).to include("Comments in report")
expect(headers).to include("Link to activity")
expect(headers).to include("Published on IATI")
end
end

Expand All @@ -235,6 +239,8 @@
.to eql @forecast.value
expect(value_for_column("Comments in report", row))
.to eql @comment.body
expect(value_for_column("Published on IATI", row))
.to eql "Yes"
end
end
end
Expand Down Expand Up @@ -270,6 +276,7 @@
expect(headers).to include("Comments in report")
expect(headers).not_to include("Tags")
expect(headers).to include("Link to activity")
expect(headers).to include("Published on IATI")
end

context "when the report is for ISPF" do
Expand Down Expand Up @@ -324,6 +331,8 @@
.to eql @comment.body
expect(value_for_column("Link to activity", row))
.to include(@project.id)
expect(value_for_column("Published on IATI", row))
.to eql "Yes"
end

context "when the report is for ISPF" do
Expand Down

0 comments on commit a101beb

Please sign in to comment.