]> ruin.nu Git - ndwebbie.git/blobdiff - scripts/scans.pl
Bugfix, accept empty gal name
[ndwebbie.git] / scripts / scans.pl
index 8c82efc7876666feba140f0c72b91f46a6a9d72a..6bfdb8e8d6e1e0da4abcae09c1a34184e3cc82a3 100755 (executable)
@@ -55,15 +55,17 @@ while (my $group = $scangroups->fetchrow_hashref){
        $dbh->begin_work;
        my $file = get("http://game.planetarion.com/showscan.pl?scan_grp=$group->{scan_id}");
 
-       my $points = 0;
-       while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){
-               unless ($dbh->selectrow_array($oldscan,undef,$1)){
-                       $addScan->execute($1,$group->{tick},$group->{uid});
-                       ++$points;
+       if ($file){
+               my $points = 0;
+               while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){
+                       unless ($dbh->selectrow_array($oldscan,undef,$1)){
+                               $addScan->execute($1,$group->{tick},$group->{uid});
+                               ++$points;
+                       }
                }
+               $addpoints->execute($points,$group->{uid});
+               $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id});
        }
-       $addpoints->execute($points,$group->{uid});
-       $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id});
        $dbh->commit;
 }
 
@@ -77,7 +79,7 @@ my $addfleet = $dbh->prepare(q{INSERT INTO fleets (name,mission,planet,tick,amou
 my $fleetscan = $dbh->prepare(q{INSERT INTO fleet_scans (fid,id) VALUES(?,?)});
 my $addintel = $dbh->prepare(q{INSERT INTO intel (name,mission,sender,target,tick,eta,back,amount,ingal,uid)
        VALUES(?,?,?,?,?,?,?,?,?,-1) RETURNING id});
-my $intelscan = $dbh->prepare(q{INSERT INTO fleet_scans (intel,id) VALUES(?,?)});
+my $intelscan = $dbh->prepare(q{INSERT INTO intel_scans (intel,id) VALUES(?,?)});
 my $addships = $dbh->prepare(q{INSERT INTO fleet_ships (fid,ship,amount) VALUES(?,?,?)});
 my $addplanetscan = $dbh->prepare(q{INSERT INTO planet_scans
        (id,tick,planet,metal_roids,metal,crystal_roids,crystal,eonium_roids,eonium