Repository navigation
[T3746] FEAT gift_compassion: gift limits per currency, official rule in USD as fallback - #2231
Merged
Merged
Conversation
… in USD as fallback Assisted-by: claude-opus-5-5, medium, claude-code
Confidence Score: 5/5
[Medium impact] The latest update appears safe to merge and fixes the test failure on USD databases. Reviews (2) · Last reviewed commit: "[T3746] FIX gift_compassion: currency te..." · Reviewed by Greptile |
…, never in USD Assisted-by: claude-opus-5-5, medium, claude-code
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.
Ticket T3746: gift limits in the correct currencies (Nordic offices give in SEK/NOK/DKK, the official GMC limits are in USD).
What changes
gift.threshold.settings: one rule per gift type and currency (unique(gift_type_id, currency_id)); currency required, USD by default. A pre-migration sets USD on rules without a currency._get_rule(gift_type, currency)/_get_rules(currency): the rule in the requested currency, else the official one (USD), else the first one. So the official limits stay in USD and each country can add its own rule in its currency.sponsorship.gift.is_eligible: uses the rule of the gift's currency, converts the gift and the other gifts of the year into the rule's currency with_convert(oramount_us_dollarsfor USD), and messages show the right currency instead of$._compute_currencyusedselfinstead ofgiftin its loop.readme/CONFIGURE.mdexplains the setup.Tests
tests/test_gift_threshold_currency.py: 9 tests (rule choice and fallback, unique constraint, eligibility in the rule currency, official rule converted, yearly frequency). They pass on a Nordic test DB; other failures in the suite exist on 18.0 without this change.Needed by the compassion-website PR (my_compassion), which uses
_get_rule/_get_rules: merge this one first.🤖 Generated with Claude Code