]> iEval git - plack-app-gruntmaster.git/commitdiff
Fix opens
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 10 Apr 2014 13:54:44 +0000 (16:54 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 10 Apr 2014 13:54:44 +0000 (16:54 +0300)
lib/Gruntmaster/Page/Generic.pm
lib/Gruntmaster/Page/St.pm

index 089337b9473745678c16b3c2df4fe563db7cb14d..e6cd3b2603d79d594003188c2f44697b2c50b545 100644 (file)
@@ -139,6 +139,7 @@ thing {
                                contest => $env->{'gruntmaster.contest'},
                                problem => $_->{id},
                                owner   => $env->{REMOTE_USER},
+                               time    => time,
                        })
                } if $env->{'gruntmaster.contest'} && time >= db($env)->contest($env->{'gruntmaster.contest'})->start;
                say "Error when creating open: $@";
index 4625138831f74c7b0c4ca2ef40710282910d9033..0e3c316dd254775c0d895bd09c29ec1fb595c5b5 100644 (file)
@@ -32,7 +32,7 @@ sub _generate{
 
                if ($ct) {
                        my $open = db($env)->opens->find($ct->id, $job->problem->id, $job->owner->id);
-                       my $time = $job->date - ($open || $ct->start);
+                       my $time = $job->date - ($open ? $open->time : $ct->start);
                        next if $time < 0;
                        my $value = $job->problem->value // LEVEL_VALUES->{$job->problem->level};
                        $scores{$job->owner->id}{$job->problem->id} = $job->result ? 0 : calc_score ($value, $time, $tries{$job->owner}{$job->problem}, $ct->stop - $ct->start);
This page took 0.028459 seconds and 4 git commands to generate.