]> ruin.nu Git - ndwebbie.git/commitdiff
Rename the shipname attribute
authorMichael Andreen <harv@ruin.nu>
Tue, 3 Aug 2010 19:16:18 +0000 (21:16 +0200)
committerMichael Andreen <harv@ruin.nu>
Tue, 3 Aug 2010 19:16:18 +0000 (21:16 +0200)
database/shipname.sql [new file with mode: 0644]
lib/NDWeb/Controller/Calls.pm
lib/NDWeb/Controller/Raids.pm
scripts/stats.pl

diff --git a/database/shipname.sql b/database/shipname.sql
new file mode 100644 (file)
index 0000000..7a6144f
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE ship_stats RENAME COLUMN name TO ship;
index 0ba04a513c40f2ceabe72a14b0bab6b504afb216..dac7f32b5a1ec279014b9a3754cd463c5108fd55 100644 (file)
@@ -161,7 +161,7 @@ WITH lc AS (
        SELECT fid,(sum(amount*(metal+crystal+eonium)) / value)::int  AS value_ratio
        FROM lcp
                JOIN fleet_ships fs USING (fid)
-               JOIN ship_stats s ON s.name = fs.ship
+               JOIN ship_stats s USING (ship)
        GROUP BY fid, value
 )
 SELECT DISTINCT ON (x,y,z,pid,name,amount,back) fid,mission, name, eta
index b756d565b13191ffa59315a93ede926b408d2adb..781f4c179db942308a2d7ee57573ad354d9ae9f5 100644 (file)
@@ -667,7 +667,7 @@ sub calcredir : Private {
        );
 
        my $ships = $dbh->prepare(q{
-SELECT id, amount FROM fleet_ships fs JOIN ship_stats s ON s.name = fs.ship
+SELECT id, amount FROM fleet_ships fs JOIN ship_stats s USING (ship)
 WHERE fid = $1
                });
 
index 5b7d6a2136546054ccab6e3c53dc6cc6ecd98310..f90f16a134da2ec48794faa7d5f6160494f30765 100755 (executable)
@@ -40,7 +40,7 @@ my %classes = (Fighter => 'Fi', Corvette => 'Co', Frigate => 'Fr', Destroyer =>
 
 my $file = get("http://game.planetarion.com/manual.pl?page=stats");
 $dbh->begin_work;
-my $st = $dbh->prepare(q{INSERT INTO ship_stats (name,"class",t1,t2,t3,"type",init,guns,armor,damage,eres,metal,crystal,eonium,race) VALUES(?,?,NULLIF(?,'-'),NULLIF(?,'-'),NULLIF(?,'-'),?,?,?,?,?,?,?,?,?,?)});
+my $st = $dbh->prepare(q{INSERT INTO ship_stats (ship,"class",t1,t2,t3,"type",init,guns,armor,damage,eres,metal,crystal,eonium,race) VALUES(?,?,NULLIF(?,'-'),NULLIF(?,'-'),NULLIF(?,'-'),?,?,?,?,?,?,?,?,?,?)});
 while ($file =~ /((?:\w| )+)<\/td><td>(\w+)<\/td><td>(\w+|-)<\/td><td>(\w+|-)<\/td><td>(\w+|-)<\/td><td>(\w+)\D+(\d+)\D+(\d+)\D+(\d+)\D+?(\d+|-)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+\d+\D+\d+.+?(\w+)<\/td>/g){
        my $dmg = $10;
        $dmg = 0 if $dmg eq '-';