GROUP BY raid,p.tick,x,y
) AS a
JOIN galaxies g USING (tick,x,y)
- WHERE a.count::float / g.planets >= 0.5
+ WHERE a.count::float / NULLIF(g.planets,0) >= 0.5
ORDER BY x,y,tick
) AS raid USING (x,y)
$query->execute($id);
my @incomings;
while (my $mission = $query->fetchrow_hashref){
- my @ships;
- $ships->execute($mission->{id});
- if ($ships->rows != 0){
- while (my $ship = $ships->fetchrow_hashref){
- push @ships,$ship;
- }
- $mission->{ships} = \@ships;
- }
push @incomings,$mission;
}
$c->stash(incomings => \@incomings);
$c->stash(cloud => $cloud->html);
$c->stash(css => $cloud->css);
- my $query = $dbh->prepare(q{
+ $query = $dbh->prepare(q{
WITH p AS (SELECT pid, coords(x,y,z) FROM current_planet_stats
), t AS (SELECT pid,tag,bool_or(uid = $2) AS own,max(time) AS time
FROM planet_tags