Fix place filters ignoring event date in dated place hierarchies#2457
Open
dsblank wants to merge 1 commit into
Open
Fix place filters ignoring event date in dated place hierarchies#2457dsblank wants to merge 1 commit into
dsblank wants to merge 1 commit into
Conversation
Filter rules that match a Place by substring (People with the <birth data>, <death data>, family <event>, and generic event filters) built the displayed place name without passing the event's own date to the place displayer. When a place has multiple date-ranged parent places (e.g. Schleswig-Holstein was part of Denmark before 1865, Prussia from 1867 to 1871, and Germany after 1871), the hierarchy was resolved using today's date instead of the event's date, so filtering for the historically correct country silently failed while filtering for the modern country incorrectly matched. Fixes #12092.
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.
Summary
Filter rules that match a Place by substring —
HasBirth,HasDeath,HasFamilyEvent, and the generic event filters (HasEventBase/HasData) — resolved the displayed place name viaplace_displayer.display(db, place)without passing the event's owndate. For places with date-ranged parent places (e.g.
Schleswig-Holstein was part of Denmark before 1865, Prussia from 1867
to 1871, and Germany after 1871), the hierarchy was resolved using
today's date rather than the event's date.
As a result, filtering
People with the <birth data>: Place=Germanywould incorrectly match a person born in Schleswig-Holstein in 1854
(when it was part of Denmark), while filtering
Place=Denmarkwouldmiss that same person.
event.date(orobj.date) intoplace_displayer.display()atall 5 affected call sites.
gramps/gen/filters/rules/test/dated_place_hierarchy_test.py,a self-contained regression test suite covering
HasBirth,HasDeath,HasFamilyEvent,HasEvent, andHasDataagainst aSchleswig-Holstein/Denmark/Prussia/Germany place hierarchy.
Fixes #0012092.
Test plan
dated_place_hierarchy_test.pypass with the fixand 5/6 fail against the pre-fix code (confirmed by reverting
the fix locally and re-running).
black --checkpasses on all changed files.mypyreports no new issues on changed files.