]> iEval git - gruntmaster-data.git/commitdiff
Use PerlX::Maybe for Add
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 12 Apr 2015 20:03:45 +0000 (23:03 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 12 Apr 2015 20:03:45 +0000 (23:03 +0300)
lib/Gruntmaster/App/Command/Add.pm

index a8306758d514c613fc9dccd5128389b6333e102a..b161904f620085bf2daeadc182d42e276c318cd2 100644 (file)
@@ -12,6 +12,7 @@ use Date::Parse qw/str2time/;
 use File::Slurp qw/read_file write_file/;
 use IO::Prompter [ -style => 'bold', '-stdio', '-verbatim' ];
 use JSON::MaybeXS qw/encode_json/;
+use PerlX::Maybe;
 use Term::ANSIColor qw/RED RESET/;
 
 use constant LEVEL_VALUES => {
@@ -106,15 +107,15 @@ sub add_problem {
                runner => $runner,
                judge => $judge,
                testcnt => $testcnt,
+               maybe private => $private,
+               maybe timeout => $timeout,
+               maybe olimit => $olimit,
+               maybe gensource => $gensource,
+               maybe genformat => $genformat,
+               maybe versource => $versource,
+               maybe verformat => $verformat,
        );
-       $options{private} = $private if $private;
-       $options{timeout} = $timeout if $timeout;
-       $options{olimit} = $olimit if $olimit;
        $options{tests} = encode_json \@tests if @tests;
-       $options{gensource} = $gensource if $gensource;
-       $options{genformat} = $genformat if $genformat;
-       $options{versource} = $versource if $versource;
-       $options{verformat} = $verformat if $verformat;
        db->insert(problems => \%options);
        db->insert(contest_problems => {problem => $id, contest => $contest}) if $contest;
 }
This page took 0.029326 seconds and 4 git commands to generate.