]> ruin.nu Git - ndwebbie.git/commitdiff
Fixed two minor bugs.
authorMichael Andreen <harv@ruin.nu>
Fri, 25 Jul 2008 09:07:45 +0000 (11:07 +0200)
committerMichael Andreen <harv@ruin.nu>
Fri, 25 Jul 2008 09:07:45 +0000 (11:07 +0200)
Actually remove duplicate scans, the die call made the remove rollback.

Remove scans for planets that have been removed, they are not useful so no point saving them.

scripts/scans.pl

index e9795f7eba5e87e49b131481289fdc9671494fa4..5b9e74eaf3a535ae718326416688aa18260f960c 100755 (executable)
@@ -97,11 +97,16 @@ while (my $scan = $newscans->fetchrow_hashref){
                        $dbh->pg_rollback_to('scans') or die "rollback didn't work";
                        $delscan->execute($scan->{id});
                        $addpoints->execute(-1,$scan->{uid}) if $scan->{uid} > 0;
-                       die "Duplicate scan: $scan->{id} http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}\n";
+                       warn "Duplicate scan: $scan->{id} http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}\n";
+                       next;
                }
                my ($planet) = $dbh->selectrow_array($findplanet,undef,$x,$y,$z,$tick);
                unless ($planet){
                        $dbh->pg_rollback_to('scans') or die "rollback didn't work";
+                       if ( $x == 0 && $y == 0 && $z == 0 ){
+                               $delscan->execute($scan->{id});
+                               $addpoints->execute(-1,$scan->{uid}) if $scan->{uid} > 0;
+                       }
                        next;
                }
                my $scantext = "";