X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData.pm;h=e2b0f8f3410e71c46bac66f81c178838b5f2246f;hb=d26f8acaf7062bc6aa8b4c4cd8bde6dc8202801e;hp=5e5c2383c21ecb08983c9f8cae0804a2bd7a1927;hpb=05fc1e15ee42bdde7243d1c798a5face4aa49146;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 5e5c238..e2b0f8f 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -3,8 +3,8 @@ use 5.014; use warnings; use parent qw/Exporter/; -our $VERSION = '5999.000_015'; -our @EXPORT = qw/dbinit purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_has_problem job_list job_entry create_job standings update_status rerun_job take_job finish_job open_problem/; +our $VERSION = '6000.001'; +our @EXPORT = qw/dbinit purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_has_problem job_list job_entry create_job standings update_status rerun_job rerun_problem take_job finish_job open_problem/; our @EXPORT_OK = @EXPORT; use JSON::MaybeXS qw/decode_json/; @@ -47,6 +47,7 @@ sub db () { $db } sub dbinit { $db = DBIx::Simple->new(@_); $db->keep_statements = 100; + $db->dbh->do('SET search_path TO gruntmaster, public'); }; sub purge; @@ -192,7 +193,10 @@ sub standings { $opens{$problem, $owner} = $time; } - my $jobs = $db->select('job_entry', '*', {contest => $ct->{id}}, 'id'); + # result IS NULL if job was never run + # result = -2 if job is being rerun + my %where = (contest => $ct->{id}, result => {'>=', 0}); + my $jobs = $db->select('job_entry', '*', \%where, 'id'); while (my $job = $jobs->hash) { my $open = $opens{$job->{problem}, $job->{owner}} // $ct->{start}; @@ -475,7 +479,7 @@ Marius Gavrilescu Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2015 by Marius Gavrilescu +Copyright (C) 2014-2016 by Marius Gavrilescu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.1 or,