Skip to content

Commit

Permalink
[admin] add stats about hackers
Browse files Browse the repository at this point in the history
  • Loading branch information
avkhozov committed Aug 24, 2023
1 parent 7810961 commit d9347c2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/CS/Controller/Admin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ SQL
SQL
my $stolen_flags = $c->_tablify($db->query($sql));

# Hackers
$sql = <<SQL;
select
service_id, (select name from services where id = service_id) as service,
count(team_id) filter (where flags > 0) as hackers
from scores
where round = (select max(round) from scores)
group by service_id
order by 3 desc
SQL
my $hackers = $c->_tablify($db->query($sql));

# First bloods
$sql = <<SQL;
with tmp as (
Expand All @@ -112,7 +124,8 @@ SQL
{name => 'Installed flags', data => $installed_flags},
{name => 'Stolen flags', data => $stolen_flags},
{name => 'First bloods', data => $fb},
{name => 'Services', data => $services}
{name => 'Services', data => $services},
{name => 'Hackers', data => $hackers}
]
);
}
Expand Down

0 comments on commit d9347c2

Please sign in to comment.