X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FCalls.pm;h=7b7e523204019553f2e8fe7065595004ebf93e89;hp=7203bc11bfe82285750ee66f2266ac828a8ea840;hb=0dc4622c02076fcd47acc56ad60511b10fb522b9;hpb=6a03c42459329f8c3f6ddc96cf91e508a6d71c90 diff --git a/lib/NDWeb/Controller/Calls.pm b/lib/NDWeb/Controller/Calls.pm index 7203bc1..7b7e523 100644 --- a/lib/NDWeb/Controller/Calls.pm +++ b/lib/NDWeb/Controller/Calls.pm @@ -218,20 +218,10 @@ sub defleeches : Local { my ( $self, $c, $type ) = @_; my $dbh = $c->model; - my $query = $dbh->prepare(q{SELECT username,defense_points,count(call) AS calls - , SUM(fleets) AS fleets, SUM(recalled) AS recalled - ,count(NULLIF(fleets,0)) AS defended_calls - FROM (SELECT username,defense_points,call,count(f.back) AS fleets - , count(NULLIF(f.landing_tick + f.eta -1 = f.back,TRUE)) AS recalled - FROM users u JOIN calls c USING (uid) - LEFT OUTER JOIN ( - SELECT lc.pid,landing_tick,eta,back - FROM launch_confirmations lc JOIN fleets f USING (fid) - WHERE mission = 'Defend' - ) f USING (pid,landing_tick) - GROUP BY username,defense_points,call - ) d - GROUP BY username,defense_points ORDER BY fleets DESC, defense_points + my $query = $dbh->prepare(q{ +SELECT username, defense_points, calls, fleets, recalled, defended_calls, value, sent_value +FROM def_leeches +ORDER BY value DESC NULLS LAST, defense_points }); $query->execute;