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 6206077 commit 62c16c9
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -4708,25 +4708,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) {
red_warning({ person => $person, warning => 'One of the parents of ' . $unknown->as_string() . ' is not known'});
} else {
red_warning({ person => $person, warning => 'One of the parents of 1 child is not known'});
}
} else {
red_warning({ 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()};
}
}
if($phrase->trim()->length() > 0) {
Expand Down

0 comments on commit 62c16c9

Please sign in to comment.