X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FHandlers.pm;h=fd4fd2d7be70fca1d9456890769edb4876f884d6;hb=98a7c0aaad9552d57907c4dccbf3c656002b3c15;hp=41ccfb45ef5d249539bcda8647ef2f5b21e8f844;hpb=69ae93bf8c2c07eefbd4692d7b7b420e49eb7b12;p=gruntmaster-handlers.git diff --git a/lib/Gruntmaster/Handlers.pm b/lib/Gruntmaster/Handlers.pm index 41ccfb4..fd4fd2d 100644 --- a/lib/Gruntmaster/Handlers.pm +++ b/lib/Gruntmaster/Handlers.pm @@ -19,7 +19,7 @@ use Cwd qw/cwd/; use File::Basename qw/fileparse/; use File::Temp qw/tempdir/; use File::Copy qw/move/; -use Gruntmaster::Data qw/contest_start contest_end push_job set_job_inmeta insert_user PUBLISH/; +use Gruntmaster::Data; use constant FORMAT_EXTENSION => { C => 'c', @@ -51,7 +51,10 @@ sub submit{ $prog = $temp if $temp } die if defined $contest && $contest !~ /^\w+$/ ; - die if defined $contest && (time < contest_start $contest || time > contest_end $contest); + die if defined $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 } @@ -110,6 +114,15 @@ sub passwd{ aputs $r, 'Password changed successfully'; } +sub problem_mark_open{ + my $r = shift; + $r->uri =~ m,/ct/([^/]*)/pb/([^.]*),; + $r->log_error("Marking open for contest $1 problem $2 and user " . $r->user); + local $Gruntmaster::Data::contest = $1; + my $problem = $2; + mark_open $problem, $r->user; +} + =begin comment sub private{