Skip to content

Commit

Permalink
Remove nested if
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 28, 2024
1 parent aab2fca commit 0b06a2b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -4380,25 +4380,20 @@ sub print_person
# may be the case where someone married more than once,
# and has a child by a 3rd unknown (or unfound) person
if($opts{'w'}) {
if(($numberofchildren - $childrenseen) == 1) {
if($unknown) {
complain({ person => $person, warning => 'One of the parents of ' . $unknown->as_string() . ' is not known'});
} else {
complain({ person => $person, warning => 'One of the parents of 1 child is not known'});
}
} else {
complain({ person => $person, warning => 'One of the parents of ' . ($numberofchildren - $childrenseen) . ' children is not known'});
}
my $children_missing_parents = $numberofchildren - $childrenseen;
my $warning_message = $children_missing_parents == 1
? 'One of the parents of ' . ($unknown ? $unknown->as_string() : '1 child') . ' is not known'
: "One of the parents of $children_missing_parents children is not known";

complain({ person => $person, warning => $warning_message });
}
} else {
foreach my $spouse(@spouses) {
if($parentofall && $childrenbyspouse{$spouse->xref()}) {
$parentofall = undef;
last;
}
if($childrenbyspouse{$spouse->xref()}) {
$parentofall = $spouse;
}
$parentofall = $spouse if $childrenbyspouse{$spouse->xref()};
}
}

Expand Down

0 comments on commit 0b06a2b

Please sign in to comment.