From b3d2ed8278ff6e71ad3de996105351252f434398 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 1 Nov 2023 22:38:30 +0100 Subject: [PATCH] Fix an issue where someone signed up and then duplicating themselves would cause a crash. --- bin/sync.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/sync.pl b/bin/sync.pl index 0c90ce6..c936ea0 100644 --- a/bin/sync.pl +++ b/bin/sync.pl @@ -280,6 +280,8 @@ sub find_diff { if (!exists($seen_names->{lc $real_name})) { # TODO: This can somehow come if we try to add someone who's not in the sheet, too? skv_log("Ønsket å fjerne at $real_name skulle på trening, men de var ikke i regnearket lenger."); + } elsif (scalar @{$seen_names->{lc $real_name}} > 1) { + # Don't touch them. } else { skv_log("Fjerner at $real_name skal på trening."); push @diffs, [ @@ -549,9 +551,13 @@ sub run { for my $diff (@diffs) { my $real_name = $diff->[0]; - # See if we can find them in the spreadsheet. my $seen = $seen_names{lc $real_name}; - die if (!defined($seen) || scalar @$seen > 1); + + # We've already complained about these earlier, so just skip them silently. + next if (scalar @$seen > 1); + + # See if we can find them in the spreadsheet. + die "Could not find $real_name" if (!defined($seen)); my $rowno = $seen->[0][1]; my $colno = $seen->[0][2]; push @yellow_updates, { -- 2.39.2