From: Marius Gavrilescu Date: Sun, 15 Feb 2015 16:30:11 +0000 (+0200) Subject: Do not show users with no jobs in user_list X-Git-Tag: 5999.000_014~70 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=a78c65b6368d9f4a4598a9cb2c7820a29d38747e;p=gruntmaster-data.git Do not show users with no jobs in user_list --- 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 {