use strict;
use warnings;
+use local::lib;
use DBI;
use DBD::Pg qw(:pg_types);
-use LWP::Simple;
-
-use lib qw{/var/www/ndawn/lib/};
+use FindBin;
+use lib "$FindBin::Bin/../lib";
use ND::Include;
use ND::DB;
our $dbh = ND::DB::DB();
-$ND::DBH = $dbh;
-
my $tick = $ARGV[0];
my $hour;
$dbh->begin_work;
if (@_ = $dumps->fetchrow){
$_ = $_[0];
$hour = (gmtime($_[1]))[2];
- while (m/(\d+)\t(\d+)\t\"(?:.+)\"\t(\d+)\t(\d+)\t(\d+)\t(\d+)/g){
+ while (m/(\d+)\t(\d+)\t\"(?:.*)\"\t(\d+)\t(\d+)\t(\d+)\t(\d+)/g){
push @galaxies,[$tick,$1,$2,$3,$4,$5,$6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
}
}
sizerank_gain_day, scorerank_gain_day, valuerank_gain_day, xprank_gain_day,
planets,planets_gain,planets_gain_day
) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)});
+$dbh->do(q{DELETE FROM galaxies WHERE tick = $1},undef,$tick);
my $countplanets = $dbh->prepare(q{SELECT count(*) from planet_stats where x = $1 and y = $2 and tick = $3});
for my $galaxy (@galaxies) {