From cfb123d9e85d0370724ecb3c4b97cf9d7769393c Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 28 Mar 2015 16:50:47 +0200 Subject: [PATCH] Return only first 200 users from user_list --- lib/Gruntmaster/Data.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index fbfabcf..d2fe636 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -56,14 +56,16 @@ sub user_list { } $contests{$_->rawowner}++ for $self->contest_statuses->all; - [ sort { $b->{solved} <=> $a->{solved} or $b->{attempted} <=> $a->{attempted} } ## no critic (ProhibitReverseSort) - grep { $_->{solved} || $_->{attempted} } map { + my @users = sort { $b->{solved} <=> $a->{solved} or $b->{attempted} <=> $a->{attempted} } ## no critic (ProhibitReverseSort) + map { my $id = $_->id; +{ $_->get_columns, solved => ($solved{$id} // 0), attempted => ($attempted{$id} // 0), contests => ($contests{$id} // 0) } - } $rs->all ] + } $rs->all; + @users = @users[0 .. 199] if @users > 200; + \@users } sub user_entry { -- 2.39.2