From 23bde5b8d2d759b66627b42c0a6726fbae76abef Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 10 Apr 2014 16:54:44 +0300 Subject: [PATCH] Fix opens --- lib/Gruntmaster/Page/Generic.pm | 1 + lib/Gruntmaster/Page/St.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Gruntmaster/Page/Generic.pm b/lib/Gruntmaster/Page/Generic.pm index 089337b..e6cd3b2 100644 --- a/lib/Gruntmaster/Page/Generic.pm +++ b/lib/Gruntmaster/Page/Generic.pm @@ -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: $@"; diff --git a/lib/Gruntmaster/Page/St.pm b/lib/Gruntmaster/Page/St.pm index 4625138..0e3c316 100644 --- a/lib/Gruntmaster/Page/St.pm +++ b/lib/Gruntmaster/Page/St.pm @@ -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); -- 2.39.2