]> git.sesse.net Git - skvidarsync/commitdiff
Fix an issue where someone signed up and then duplicating themselves would cause...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 1 Nov 2023 21:38:30 +0000 (22:38 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 1 Nov 2023 21:38:30 +0000 (22:38 +0100)
bin/sync.pl

index 0c90ce6362dea1977843abdb8c8f8d4d6a93157e..c936ea0ab1c2b5e6ac531b04d9330ac2d709fdcd 100644 (file)
@@ -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, {