X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=calls.pl;h=0b843dfdb09dd910ad4e3481cced2294f39a4914;hb=870325485adff6e11c7d43fd9a3146f943ab735b;hp=ad7e13c449c20ed2cc8506a9e0b5831d33691c28;hpb=0261522c27d089adb08a6055c2c9e9b41459dd6e;p=ndwebbie.git diff --git a/calls.pl b/calls.pl index ad7e13c..0b843df 100644 --- a/calls.pl +++ b/calls.pl @@ -170,6 +170,10 @@ ORDER BY p.x,p.y,p.z}); }elsif (param('show') eq 'uncovered'){ $where = 'not covered'; } + my $pointlimits = $DBH->prepare(q{SELECT value :: int FROM misc WHERE id = ?}); + my ($minpoints) = $DBH->selectrow_array($pointlimits,undef,'DEFMIN'); + my ($maxpoints) = $DBH->selectrow_array($pointlimits,undef,'DEFMAX'); + my $query = $DBH->prepare(qq{ SELECT c.id, coords(p.x,p.y,p.z), u.defense_points, c.landing_tick, TRIM('/' FROM concat(p2.race||' /')) AS race, TRIM('/' FROM concat(i.amount||' /')) AS amount, @@ -190,10 +194,17 @@ ORDER BY c.landing_tick DESC my @calls; my $i = 0; while (my $call = $query->fetchrow_hashref){ + if ($call->{defense_points} < $minpoints){ + $call->{DefPrio} = 'LowestPrio'; + }elsif ($call->{defense_points} < $maxpoints){ + $call->{DefPrio} = 'MediumPrio'; + }else{ + $call->{DefPrio} = 'HighestPrio'; + } + $i++; $call->{ODD} = $i % 2; $call->{shiptype} = escapeHTML($call->{shiptype}); push @calls, $call; - $i++; } $BODY->param(Calls => \@calls); }