From: Marius Gavrilescu Date: Wed, 29 Jan 2014 13:03:45 +0000 (+0200) Subject: Add contest support and prevent some bugs X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=2fdef0a7047033bcd2954af1020ff3a99493cd82;p=gruntmaster-handlers.git Add contest support and prevent some bugs --- diff --git a/lib/Gruntmaster/Handlers.pm b/lib/Gruntmaster/Handlers.pm index 41ccfb4..7b6bddc 100644 --- a/lib/Gruntmaster/Handlers.pm +++ b/lib/Gruntmaster/Handlers.pm @@ -52,6 +52,9 @@ sub submit{ } die if defined $contest && $contest !~ /^\w+$/ ; die if defined $contest && (time < contest_start $contest || time > contest_end $contest); + return aputs 'A required parameter was not supplied' if grep { !defined } $problem, $format, $prog; + + local $Gruntmaster::Data::contest = $contest; my $job = push_job ( date => time, @@ -73,7 +76,8 @@ sub submit{ } }; - PUBLISH 'jobs', $job; + $contest //= ''; + PUBLISH 'jobs', "$contest.$job"; $r->print("Job submitted"); OK }