X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData.pm;h=949e1a41910b7bb3be44c8a8edd7e6a64f1f8f07;hb=aaa9eb7d81598848183239016890f3a851082154;hp=c3aa9975f62ede2c83ae5e9d63856789e8dd5f07;hpb=35596ea828c058c16154e7503e40f57aef8aedfa;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index c3aa997..949e1a4 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -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));