Repository navigation
Conversation
The first picture of a child is fetched before the child details, so without its photo date: it got the download date. A real new photo received less than six months later was then not seen as a new one, and no biennial was prepared for the sponsor. When the photo date is not known, use the publish date contained in the picture URL. The new photo check is split from update_child_pictures so it can run without fetching pictures.
Date the pictures that got their download date with their publish date, then prepare the biennials that are still due. They are created without automatic sending, so that the sponsor service reviews them before they reach the sponsors. End migration: the communications need the country modules loaded.
|
Comments Outside DiffThese findings could not be posted inline.
|
- Only merge a caught-up child into a pending biennial that is not sent automatically either, so nothing is sent during the upgrade. - Date every picture that got its download day with its earlier publish date: the 30 days margin could still hide a due biennial. - Skip the children already in a biennial since their last picture came, so the sponsor does not receive the same picture twice. - Use the active sponsorship of the child instead of the first one: a cancelled sponsorship listed first prevented the biennial.
ecino
requested changes
Oct 29, 2026
Member
|
@danpa32 Still needs fixes. |
…e-date # Conflicts: # partner_communication_compassion/__manifest__.py
…flag Sending or cancelling a biennial cleared the new_picture flag of every sponsorship of the child, so the old sponsor's biennial of a child sponsored again hid the new sponsor's picture from the order. It now clears the flag of the child's sponsorships with the job's sponsor only, including an ended one.
18.0 is at 18.0.1.0.6 and has its own 18.0.1.0.5 migration: the catch-up moves to 18.0.1.0.7.
Assisted-by: claude-sonnet-5-5, medium, claude-code
ecino
approved these changes
Nov 4, 2026
ecino
left a comment
Member
There was a problem hiding this comment.
I updated the migration script to make it faster by using queue jobs for generating communications. We will also wait for Carole feedback before merging, for knowing whether this migration is wanted or not.
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.
T3178 — Biennial report not generated
Branch:
T3178-biennial-picture-date(repo:compassion-modules, moduleschild_compassionandpartner_communication_compassion, offorigin/18.0). v18 only.Original report
Some new child photos were not handled as a biennial: the photo was not ordered and no communication was generated to send it to the sponsor. Example: child KE073400410 (sponsor ref 1551364).
A "biennial" is the new photo Compassion International takes of each child about every two years. When it arrives,
new_photo()prepares the "New Biennial" communication for the sponsor and marks the sponsorship "new picture" so the printed photo is ordered for sponsors receiving photos by post.Root cause
update_child_pictures()(child_compassion/models/child_compassion.py) only callsnew_photo()when the latest picture is at least 6 months after the previous one (and at most 6 months old).A picture is dated with the child's photo date, or with today if it is not known yet (
child_pictures._get_picture). When a child is fetched for the first time, its pictures are fetched before the child details, on purpose ("directly fetch picture to have it before get_infos"), so the first picture of every child gets its download date.For KE073400410:
.../v1722936507/...).../v1778056903/...)Real gap about 21 months, stored gap 5 months: no biennial. On the v14 database, about 710 children with a latest picture since 2025 were affected this way (479 currently sponsored).
Fix
child_compassion: when the photo date is not known, a picture is dated with the publish date contained in its URL (the media server URL holds the upload timestamp), and only then with today. The new photo check is split fromupdate_child_pictures()into_check_new_photo(), so it can run without fetching pictures.partner_communication_compassion18.0.1.0.7, end migration (catch-up):default_auto_send=False), so that the sponsor service reviews them before they reach the sponsors. Without it, sponsors with an automatic digital preference would receive the email during the upgrade. A caught-up child is only merged into an existing pending biennial of the same sponsor if that one is not sent automatically either.report_compassion, loaded afterpartner_communication_compassion).partner_communication_compassion:new_photo()used the first sponsorship of the child (sponsorship_ids[0]) to check it is active and to mark the printed photo. A child with a cancelled sponsorship listed before the active one got no biennial (e.g. HA075400821). It now uses the active sponsorship. Sending or cancelling a biennial clears the "new picture" mark of the child's sponsorships with the sponsor the communication is addressed to (also an ended one), and leaves the other sponsorships alone: when the child was sponsored again, the old sponsor's biennial no longer hides the new sponsor's picture from the order.Review (Greptile)
Both findings verified and fixed: the 30 days margin on the re-dating could still leave a due biennial missed, and merging a caught-up child into an existing pending auto-send job would have sent it during the upgrade.
Review (ecino, 2026-10-29)
Commits
12602bb9— Date the first child picture with its publish date48b29ccc— Catch up the biennials missed because of the picture datese9eab26f— Address review: never send the catch-up, skip handled photosa5040bdd— merge of 18.08286df59— Address review: a biennial clears only its sponsor's picture flagdb88ba24— Address review: version after 18.0 (18.0.1.0.7)What happens in production when this is deployed
How to test manually
After
-u partner_communication_compassionon a copy of production:Verification log
Manual test (after the Greptile review fixes): 37,303 pictures re-dated; 9,243 children skipped because already in a biennial; 143 new pending biennial communications prepared plus 1 child merged into an existing pending one (144 jobs, 149 children), none sent automatically; 136 sponsorships marked "new picture"; 0 other communications created. KE073400410 and HA075400821 both get their biennial. The list was exported for the sponsor service (
T3178_biennial_catchup.csv; the production list will differ at deployment).Manual test (after ecino's review): for a child sponsored by two sponsors in turn, cancelling the old sponsor's biennial clears only the mark of the old (ended) sponsorship; the active sponsorship keeps its mark until the current sponsor's biennial is sent or cancelled.
Not changed
partner_communication_switzerlandorder wizard (child_order_picture.py): its filter("state", "not in", [("terminated", "cancelled")])holds a tuple inside the list, so ended sponsorships are not excluded. Separate issue.v14 (production) is not fixed, by decision: biennials keep being missed there until v18 is live, and the catch-up only covers photos at most 6 months old at deployment.
🤖 Generated with Claude Code