Repository navigation
fix(cli): drop non-gift rows from the raw gift log used by check and leadership - #353
Merged
Merged
Conversation
…leadership `philanthropy check` and `philanthropy train --task leadership` read the export through `_read_raw_gifts`, which only renamed headers. Raiser's Edge pledges were summed next to the payments against them, and cancelled, pending or test-mode CiviCRM contributions, NPSP open stages and unpaid Nonprofit Cloud schedules all counted as gifts, while `features` on the same file dropped them. Each bridge's row filter now lives in a private `_<crm>_received_rows` helper that both its `*_to_features` aggregator and the CLI call, and the CiviCRM id dedup, test-mode and status filter moved into `_civicrm_received_rows` the same way. The CLI turns a bridge's missing-field KeyError into a SystemExit message, as `features` already did. Closes #337
This file contains hidden or 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
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.
What & why
philanthropy checkandphilanthropy train --task leadershipbuilt their gift log with_read_raw_gifts, which only renamed headers. None of the row filters the ingest bridges apply ran on that path, so a Raiser's Edge pledge was summed next to its payment, and cancelled or test-mode CiviCRM contributions, NPSP open stages and unpaid Nonprofit Cloud schedules all counted as gifts.philanthropy featureson the same file dropped them.On
main:On this branch both read 1000.0 and 500.0.
How
_raisers_edge_received_rows,_npsp_received_rows,_nonprofit_cloud_received_rows). The public*_to_featuresfunctions call it and behave exactly as before._civicrm_received_rows, which the aggregator calls._read_raw_giftscalls the same helpers, so there is one definition of "a received gift" per CRM instead of two. It also turns a bridge's missing-fieldKeyErrorinto theSystemExitmessagefeaturesalready prints.features.stacklevel=3so they still point at the caller after moving one frame deeper.Closes #337
Testing
test_raw_gift_log_drops_the_rows_features_drops, parametrised over the four CLI sources: one counted row and one excluded row each, compared againstread_gifts.checkandtrain --task leadershipfixtures now carry a Gift Type column, since the CLI now (correctly) warns when it is missing.make ci: 2958 passed, coverage 98.64%.make riskcov: passed. flake8 clean.Follow-up: #341 extends the same treatment to the Bloomerang, DonorPerfect and Blackbaud CRM sources.
Checklist
make cipasses locallyCHANGELOG.mdupdated under[Unreleased]