]> iEval git - plack-app-gruntmaster.git/commitdiff
Prevent participation in both divisions of a round
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Feb 2016 00:37:21 +0000 (00:37 +0000)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Feb 2016 00:47:04 +0000 (00:47 +0000)
lib/Plack/App/Gruntmaster.pm

index 7b927d5958b27863254b7f4617f497b2e4294e33..8d9684266adb6093930aa10feea048335e249967 100644 (file)
@@ -190,6 +190,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;
This page took 0.028031 seconds and 4 git commands to generate.