]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data.pm
Make perlcritic happy
[gruntmaster-data.git] / lib / Gruntmaster / Data.pm
index 2706f94338f643e17bd84c71f1b8e3cfb9ae1965..d8c7c310729fc0a9fe7107e7ed3e2a21dc3c2f16 100644 (file)
@@ -1,5 +1,5 @@
 package Gruntmaster::Data;
-use v5.14;
+use 5.014;
 use warnings;
 
 use parent qw/Exporter/;
@@ -70,10 +70,10 @@ sub object_name {
 }
 
 
-sub add_names ($) {
+sub add_names ($) { ## no critic (ProhibitSubroutinePrototypes)
        my ($el) = @_;
        if (ref $el eq 'ARRAY') {
-               &add_names ($_) for @$el
+               &add_names ($_) for @$el ## no critic (ProhibitAmpersandSigils)
        } else {
                for my $object (qw/contest owner problem/) {
                        my $table = $object eq 'owner' ? 'users' : "${object}s";
@@ -84,7 +84,7 @@ sub add_names ($) {
        $el
 }
 
-sub user_list { scalar query('user_list_sth')->hashes }
+sub user_list { +{us => scalar query('user_list_sth')->hashes} }
 
 sub user_entry {
        my ($id) = @_;
@@ -116,8 +116,8 @@ sub problem_list {
 }
 
 sub problem_entry {
-       my ($id, $contest, $user) = @_;
-       $contest &&= contest_entry $contest;
+       my ($id, $contest) = @_;
+       $contest &&= contest_entry ($contest);
        my $ret = add_names query(problem_entry_sth => $id)->hash;
        my $limits = query(limits_sth => $id)->hashes;
        $ret->{limits} = $limits if @$limits;
@@ -125,6 +125,7 @@ sub problem_entry {
        if ($contest) {
                $ret->{contest_start} = $contest->{start};
                $ret->{contest_stop}  = $contest->{stop};
+               delete $ret->{solution}
        }
 
        $ret
@@ -221,7 +222,6 @@ sub standings {
        my @problems = query(contest_problems_sth => $ct->{id})->flat;
        my $pblist = problem_list;
        my %values = query('problem_values_sth')->map;
-#      $values{$_} = $values{$_}->{value} for keys %values;
 
        my (%scores, %tries, %opens);
        my $opens = query(opens_sth => $ct->{id});
@@ -260,7 +260,7 @@ sub standings {
 }
 
 sub update_status {
-       my $jobs = $db->select('jobs', 'id,owner,problem,result', {}, 'id');
+       my $jobs = $db->select('jobs', 'id,owner,problem,result', {-not_bool => 'private'}, 'id');
 
        my %hash;
        while ($jobs->into(my ($id, $owner, $problem, $result))) {
This page took 0.025464 seconds and 4 git commands to generate.