From a78c65b6368d9f4a4598a9cb2c7820a29d38747e Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 15 Feb 2015 18:30:11 +0200 Subject: [PATCH] Do not show users with no jobs in user_list --- lib/Gruntmaster/Data.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 28b520a..d9f61aa 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -56,13 +56,14 @@ sub user_list { } $contests{$_->rawowner}++ for $self->contest_statuses->all; - [ sort { $b->{solved} <=> $a->{solved} or $b->{attempted} <=> $a->{attempted} } map { ## no critic (ProhibitReverseSort) - my $id = $_->id; - +{ $_->get_columns, - solved => ($solved{$id} // 0), - attempted => ($attempted{$id} // 0), - contests => ($contests{$id} // 0) } - } $rs->all ] + [ sort { $b->{solved} <=> $a->{solved} or $b->{attempted} <=> $a->{attempted} } ## no critic (ProhibitReverseSort) + grep { $_->{solved} || $_->{attempted} } map { + my $id = $_->id; + +{ $_->get_columns, + solved => ($solved{$id} // 0), + attempted => ($attempted{$id} // 0), + contests => ($contests{$id} // 0) } + } $rs->all ] } sub user_entry { -- 2.39.2