From e7282982e875d595d558488b9a3b8a5cd481fb71 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Thu, 23 May 2024 10:13:27 -0400 Subject: [PATCH] Improved algorithm to see if living with a parent --- gedcom | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/gedcom b/gedcom index 16d0c58..3f6726e 100755 --- a/gedcom +++ b/gedcom @@ -4988,7 +4988,9 @@ sub print_person if(1) { my $with_mother; my $same_road_as_mother = 0; - my $road = $residence->address(); + my $address = $residence->address(); + my $road = $address; + if($road) { if($road =~ /,\s*(.+)/) { $road = $1; @@ -5006,20 +5008,10 @@ sub print_person my $p = place({ person => $mother, record => $mr, nopreposition => 1 }); next unless($p); - # if(($p =~ /^\s\d/) && ($p eq $place)) { - if($p eq $place) { - if($mdate eq $rdate) { - $with_mother++; - $living_alone = 0; - last; - } elsif(!$printed_mother_same_place) { - $mother_date = $mdate; - } - } if(($rdate eq $mdate) && $road && ($mr->place() eq $residence->place())) { if(my $mroad = $mr->address()) { - if($mroad eq $road) { + if($mroad eq $address) { $living_with{'mother'} = $mother; } if($mroad =~ /,\s*(.+)/) { @@ -5033,6 +5025,17 @@ sub print_person } } } + + # if(($p =~ /^\s\d/) && ($p eq $place)) { + if($p eq $place) { + if($mdate eq $rdate) { + $with_mother++; + $living_alone = 0; + last; + } elsif(!$printed_mother_same_place) { + $mother_date = $mdate; + } + } } if($with_mother && !$living_with{'mother'}) { complain({ person => $person, warning => "May have been living with mother on $rdate, but the addresses don't match or aren't detailed enough to be sure" }); @@ -5049,20 +5052,10 @@ sub print_person my $p = place({ person => $father, record => $fr, nopreposition => 1 }); next unless($p); - # if(($p =~ /^\s\d/) && ($p eq $place)) { - if($p eq $place) { - if($fdate eq $rdate) { - $with_father++; - $living_alone = 0; - last; - } elsif(!$printed_father_same_place) { - $father_date = $fdate; - } - } if(($rdate eq $fdate) && $road && ($fr->place() eq $residence->place())) { if(my $froad = $fr->address()) { - if($froad eq $road) { + if($froad eq $address) { $living_with{'father'} = $father; } if($froad =~ /,\s*(.+)/) { @@ -5076,6 +5069,18 @@ sub print_person } } } + + # if(($p =~ /^\s\d/) && ($p eq $place)) { + if($p eq $place) { + if($fdate eq $rdate) { + $with_father++; + $living_alone = 0; + last; + } elsif(!$printed_father_same_place) { + $father_date = $fdate; + } + } + } if($with_father && !$living_with{'father'}) { complain({ person => $person, warning => "May have been living with father on $rdate, but the addresses don't match or aren't detailed enough to be sure" }); @@ -5158,7 +5163,7 @@ sub print_person } } elsif(($mother || $father) && ($bdiff->in_units('years') < 16)) { if(!($with_mother || $with_father)) { - complain({ person => $person, warning => [ 'Not living with either parent in childhood when aged ', $bdiff->in_units('years') ] }); + complain({ person => $person, warning => [ "$rdate: Not living with either parent in childhood when aged ", $bdiff->in_units('years') ] }); } $living_alone = 0; } elsif($father_date && (datecmp($rdate, $father_date) >= 0)) {