X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FPlack%2FApp%2FGruntmaster.pm;h=cda45fc04ded26aacac855140c8a0ec42e058928;hb=refs%2Fheads%2Fnewmc;hp=7b927d5958b27863254b7f4617f497b2e4294e33;hpb=bf660b84639bcfd78ce2851bf6b6169b92f9007a;p=plack-app-gruntmaster.git diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 7b927d5..cda45fc 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -24,16 +24,20 @@ use constant USER_REGEX => qr/^\w{2,20}$/a; use constant FORMAT_EXTENSION => { C => 'c', CPP => 'cpp', + D => 'd', GCCGO => 'go', GOLANG => 'go', GOLFSCRIPT => 'gs', HASKELL => 'hs', OBERON => 'm', MONO => 'cs', + OCAML => 'ml', JAVA => 'java', PASCAL => 'pas', PERL => 'pl', + PHP => 'php', PYTHON => 'py', + PYTHON3 => 'py', RUBY => 'rb', SBCL => 'l', }; @@ -190,6 +194,11 @@ sub dispatch_request{ return reply 'This contest has finished' if $contest->{finished}; return reply 'This problem is private' if !admin && $private; return reply 'This problem does not belong to this contest' unless contest_has_problem $_{contest}, $_{problem}; + if ($_{contest} =~ /d[12]$/) { + my $other = $_{contest} =~ y/12/21/r; + my ($ans) = db->query('SELECT COUNT(*) FROM jobs WHERE owner = ? AND contest = ?', remote_user->{id}, $other)->flat; + return reply 'You are not allowed to participate in both divisions of a round' if $ans; + } } return reply 'Maximum source size is 10KB' if ($prog ? $prog->size : length $_{source_code}) > 10 * 1024; return reply 'You must wait 30 seconds between jobs' if !admin && time <= remote_user->{lastjob} + 30;