relatives-tree icon indicating copy to clipboard operation
relatives-tree copied to clipboard

Missing/misplaced children of remarried parents

Open Phen-Ro opened this issue 7 months ago • 1 comments

I found a rendering issue with situations regarding children of one side of a couple or children of a parent with multiple spouse. In all of the following examples, the rootId is "Mother".

This can be imagined as a story of a divorced couple with a child, where the mother remarries, and the child's father is removed from the family tree.

Standard unit, renders correctly:

[
  { "id": "Mother", "gender": "female", "spouses": [{ "id": "Father", "type": "divorced" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Father", "gender": "male", "spouses": [{ "id": "Mother", "type": "divorced" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Child", "gender": "male", "spouses": [], "siblings": [], "parents": [{ "id": "Mother", "type": "blood" }, { "id": "Father", "type": "blood" }], "children": [] }
]

Actual & Expected:

[Mother]---[Father]
         |
      [Child]

When the mother remarries, the child is now linked only to the father:

[
  { "id": "Mother", "gender": "female", "spouses": [{ "id": "Father", "type": "divorced" }, { "id": "Husband", "type": "married" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Father", "gender": "male", "spouses": [{ "id": "Mother", "type": "divorced" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Husband", "gender": "male", "spouses": [{ "id": "Mother", "type": "married" }], "siblings": [], "parents": [], "children": [] },
  { "id": "Child", "gender": "male", "spouses": [], "siblings": [], "parents": [{ "id": "Mother", "type": "blood" }, { "id": "Father", "type": "blood" }], "children": [] }
]

Actual:

[Father]---[Mother]---[Husband]
   |
[Child]

Expected:

[Father]---[Mother]---[Husband]
         |
      [Child]

If the father is removed, the child disappears:

[
  { "id": "Mother", "gender": "female", "spouses": [{ "id": "Husband", "type": "married" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Husband", "gender": "male", "spouses": [{ "id": "Mother", "type": "married" }], "siblings": [], "parents": [], "children": [] },
  { "id": "Child", "gender": "male", "spouses": [], "siblings": [], "parents": [{ "id": "Mother", "type": "blood" }], "children": [] }
]

Actual:

[Mother]---[Husband]

Expected:

[Mother]---[Husband]
   |
[Child]

When the 2nd husband is removed, the child reappears:

[
  { "id": "Mother", "gender": "female", "spouses": [{ "id": "Husband", "type": "married" }], "siblings": [], "parents": [], "children": [{ "id": "Child", "type": "blood" }] },
  { "id": "Child", "gender": "male", "spouses": [], "siblings": [], "parents": [{ "id": "Mother", "type": "blood" }], "children": [] }
]

Actual & Expected:

[Mother]
   |
[Child]

Here's a similar situation, the one that got me investigating this. This is a single mother of one who (re)marries and has another kid with the new guy:

[
  { "id": "Mother", "gender": "female", "spouses": [{ "id": "New Guy", "type": "married" }], "siblings": [], "parents": [], "children": [{ "id": "First Child", "type": "blood" }, { "id": "New Baby", "type": "blood" }] },
  { "id": "New Guy", "gender": "male", "spouses": [{ "id": "Mother", "type": "married" }], "siblings": [], "parents": [], "children": [{ "id": "New Baby", "type": "blood" }] },
  { "id": "First Child", "gender": "male", "spouses": [], "siblings": [{ "id": "New Baby", "type": "half" }], "parents": [{ "id": "Mother", "type": "blood" }], "children": [] },
  { "id": "New Baby", "gender": "female", "spouses": [], "siblings": [{ "id": "First Child", "type": "half" }], "parents": [{ "id": "Mother", "type": "blood" }, { "id": "New Guy", "type": "blood" }], "children": [] }
]

Actual:

[Mother]---[New Guy]
         |
     [New Baby]

Expected:

  [Mother]---[New Guy]
    |      |
 [Child] [New Baby]

Are my expectations off, or is the code?

If it is the code, I have a feeling it has to do with createChildUnitsFunc and/or getSpouseNodesFunc. I haven't been able to dig too far into it, but it seems that the way Units are created pushes out children that aren't the full offspring of the computed parents, and parents who are couples aren't offered to createChildUnits as potential single parents. Or something like that. I'll see if I can do more research, but no promises. This might be related to #12.

Phen-Ro avatar Jun 25 '24 23:06 Phen-Ro