X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData.pm;h=da9d944c5e8c5e799f34ec140d75dc61118748bb;hb=7625bb863c3684441677052636abf78039f6d055;hp=4592ac1a95d8630c9a91369c6691da3436f42e7f;hpb=16fe7a4c26f7680e85adf5d8ad8752f8b3ea113c;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 4592ac1..da9d944 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -7,7 +7,7 @@ use JSON qw/encode_json decode_json/; use Redis; use Sub::Name qw/subname/; -our $VERSION = '5999.000_001'; +our $VERSION = '5999.000_002'; our $contest; my $redis = Redis->new; @@ -78,7 +78,7 @@ sub defhash{ defhash problem => qw/name level difficulty statement owner author private generator runner judge testcnt timeout olimit/; defhash contest => qw/start end name owner/; defhash job => qw/date errors extension filesize private problem result result_text user/; -defhash user => qw/name email town university level/; +defhash user => qw/name email lastjob town university level/; sub clean_job (_){ HDEL cp . "job.$_[0]", qw/result result_text results daemon/ @@ -94,14 +94,6 @@ sub get_open { HGET cp . 'open', "$problem.$user"; } -sub lastjob { - HGET 'lastjob', $_[0]; -} - -sub set_lastjob { - HSET 'lastjob', $_[0], time; -} - our @EXPORT = do { no strict 'refs'; grep { $_ =~ /^[a-zA-Z]/ and exists &$_ } keys %{__PACKAGE__ . '::'}; @@ -139,7 +131,7 @@ The current contest is selected by setting the C<< $Gruntmaster::Data::contest > Gruntmaster::Data exports some functions for talking directly to the Redis server. These functions should not normally be used, except for B, B, B, B and B. -These functions correspond to Redis commands. The current list is: B<< MULTI EXEC SMEMBERS GET HGET HDEL HSET SADD SREM INCR HMSET HSETNX DEL PUBLISH SUBSCRIBE WAIT_FOR_MESSAGES >>. +These functions correspond to Redis commands. The current list is: B<< MULTI EXEC SMEMBERS GET HGET HGETALL HDEL HSET SADD SREM INCR HMSET HSETNX DEL PUBLISH SUBSCRIBE WAIT_FOR_MESSAGES >>. =head2 Problems @@ -173,6 +165,14 @@ Returns a problem's level. The levels are beginner, easy, medium, hard. Sets a problem's level. The levels are beginner, easy, medium, hard. +=item B I<$problem> + +Returns a problem's difficulty. + +=item B I<$problem>, I<$name> + +Sets a problem's difficulty. + =item B I<$problem> Returns a problem's statement. @@ -197,6 +197,62 @@ Returns a problem's author. Sets a problem's author. +=item B I<$problem> + +Returns a problem's private flag (true if the problem is private, false otherwise). + +=item B I<$problem>, I<$private> + +Sets a problem's private flag. + +=item B I<$problem> + +Returns a problem's generator. The generators are File, Run and Undef. More might be added in the future. + +=item B I<$problem>, I<$generator> + +Sets a problem's generator. + +=item B I<$problem> + +Returns a problem's runner. The runners are File, Verifier and Interactive. More might be added in the future. + +=item B I<$problem>, I<$runner> + +Sets a problem's runner. + +=item B I<$problem> + +Returns a problem's judge. The judges are Absolute and Points. More might be added in the future. + +=item B I<$problem>, I<$judge> + +Sets a problem's judge. + +=item B I<$problem> + +Returns a problem's test count. + +=item B I<$problem>, I<$testcnt> + +Sets a problem's test count. + +=item B I<$problem> + +Returns a problem's time limit, in seconds. + +=item B I<$problem>, I<$timeout> + +Sets a problem's time limit, in seconds. + +=item B I<$problem> + +Returns a problem's output limit, in bytes. + +=item B I<$problem>, I<$olimit> + +Sets a problem's output limit, in bytes. + =item B I<$problem>, I<$user> Returns the time when I<$user> opened I<$problem>. @@ -423,6 +479,14 @@ Returns a user's email address. Sets a user's email address. +=item B I<$user> + +Returns the time (seconds since epoch) when the user last submitted a solution. + +=item B I<$user>, I<$lastjob> + +Sets the time (seconds since epoch) when the user last submitted a solution. + =item B I<$user> Returns a user's town.