- if ($Gruntmaster::Data::contest) {
- $scores{job_user()}{job_problem()} = job_result() ? 0 : calc_score (job_user(), job_problem(), job_date(), $tries{job_user()}{job_problem()}, $totaltime);
- $tries{job_user()}{job_problem()}++;
+ if ($ct) {
+ my $open = db($env)->opens->find($ct->id, $job->problem->id, $job->owner->id);
+ my $time = $job->date - ($open ? $open->time : $ct->start);
+ next if $time < 0;
+ my $value = $job->problem->value // LEVEL_VALUES->{$job->problem->level};
+ my $factor = $job->result ? 0 : 1;
+ $factor = $1 / 100 if $job->result_text =~ /(\d+)/;
+ $scores{$job->owner->id}{$job->problem->id} = int ($factor * calc_score ($value, $time, $tries{$job->owner->id}{$job->problem->id}, $ct->stop - $ct->start));
+ $tries{$job->owner->id}{$job->problem->id}++;