generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV export of all actual spend #1155
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jcoglan
force-pushed
the
feature/1802-csv-of-all-actual-spend
branch
from
May 28, 2021 15:52
9b2d746
to
fabaae9
Compare
jcoglan
force-pushed
the
feature/1802-csv-of-all-actual-spend
branch
3 times, most recently
from
May 28, 2021 17:05
41aeb27
to
08c6ed9
Compare
pezholio
reviewed
Jun 1, 2021
Comment on lines
+31
to
+32
echo "==> Running Brakeman" | ||
bundle exec brakeman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
pezholio
approved these changes
Jun 1, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Brakeman is a form of static analysis that's relatively quick compared to running all your tests. I'd rather run anything quick that might fail for surprising reasons (like this and Standard) before running the whole test suite, so I get alerted to gotchas without waiting for the entire build.
This module was not working in some contexts because it assumes something else has loaded the CSV module, which isn't the case especially in some tests.
Given a set of activities, QuarterlyTransactionExport generates a CSV-compatible response that shows the total actual spend by quarter for all the given activities. All the transactions linked to the given activities are loaded in a single query, and their earliest and latest financial quarter is found. We export a column for every quarter in this range, putting "0.00" in cells where no spend is recorded for that activity and quarter. So the columns in the response are the activity RODA and BEIS identifiers, followed by every quarter from the earliest to the latest we have records for. The rows are all the activities in the set, including ones with no spending recorded. This design lets us export a complete set of all data across all organisations for a BEIS user, or just the activities for a particular organisation for a delivery partner.
This exposes the functionality of the QuarterlyTransactionExport service by providing two new pages: - /exports: - lists all the delivery partners registered in RODA - /exports/organisations/:id - lists all the exports available for the delivery partner So far only one export is available: the summary of all the transaction totals by quarter for all the delivery partner's activities.
This adds permissions to the ExportsController and Exports::OrganisationsController to make sure those pages are only accessible to BEIS users. So far it is only staff inside BEIS that need this functionality so it's simplest to restrict it to them at first.
jcoglan
force-pushed
the
feature/1802-csv-of-all-actual-spend
branch
from
June 1, 2021 10:17
08c6ed9
to
d7274bb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes in this PR
This adds the ability for BEIS users to download all the transactions for each delivery partner as a CSV file that lists all the partner's activities with their total spending by quarter.
The main points of note here are that we probably want to iterate the design here -- do we want this split up by delivery partner, or should we have one big download? Do we need it more granular and split up by fund, etc.
The permissions here are very coarse, I've just limited this to only BEIS users. I'd expect this to change as iterating the design would probably mean changing the routes/resources/controllers we have here so I didn't want to get too into modelling permissions over those until we've a better idea of what we really want.
Screenshots of UI changes
All these changes are only visible to BEIS users. A new item is added to the top-level navigation:
This links to a list of all delivery partner organisations:
Each organisation links through to a list of exports for that organisation:
Clicking "Download" provides the user with a CSV file containing all the transaction totals per quarter for all that organisation's activities. All activities are included even if they have no spend in any of the listed quarters. The set of quarter columns covers every quarter from the earliest to the most recent transaction in the set.
Next steps
CHANGELOG.md
, unless this PR is a small tweak which has no impact outside the development team.