]> iEval git - gruntmaster-data.git/blobdiff - lib/Gruntmaster/Data.pm
Make problem value NOT NULL
[gruntmaster-data.git] / lib / Gruntmaster / Data.pm
index c3aa9975f62ede2c83ae5e9d63856789e8dd5f07..949e1a41910b7bb3be44c8a8edd7e6a64f1f8f07 100644 (file)
@@ -15,10 +15,10 @@ __PACKAGE__->load_namespaces;
 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-05 13:11:39
 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dAEmtAexvUaNXLgYz2rNEg
 
-our $VERSION = '5999.000_008';
+our $VERSION = '5999.000_010';
 
 use Lingua::EN::Inflect qw/PL_N/;
-use JSON qw/decode_json/;
+use JSON::MaybeXS qw/decode_json/;
 use List::Util qw/sum/;
 use PerlX::Maybe qw/maybe/;
 use Sub::Name qw/subname/;
@@ -42,13 +42,6 @@ BEGIN {
        }
 }
 
-use constant LEVEL_VALUES => {
-       beginner => 100,
-       easy => 250,
-       medium => 500,
-       hard => 1000,
-};
-
 sub calc_score{
        my ($mxscore, $time, $tries, $totaltime) = @_;
        my $score = $mxscore;
@@ -71,7 +64,7 @@ sub standings {
                        my $open = $self->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 $value = $job->problem->value;
                        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));
This page took 0.018573 seconds and 4 git commands to generate.