]> iEval git - gruntmaster-page.git/commitdiff
Simplify calls to process_pb_entry and process_log
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 21 Mar 2015 11:36:35 +0000 (13:36 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 21 Mar 2015 11:36:35 +0000 (13:36 +0200)
lib/Plack/App/Gruntmaster.pm
lib/Plack/App/Gruntmaster/HTML.pm

index f401e3f5d403272e4ad971388ffea3755ae70428..9284acc1a8b1eae97cd01e579b894d3d4e647481 100644 (file)
@@ -149,7 +149,7 @@ sub dispatch_request{
                sub (/ct/  + ?:owner~)                            { response ct => 'Contests', db->contest_list(%_), 300 },
                sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~&:result~) {
                        forbid $_{private};
                sub (/ct/  + ?:owner~)                            { response ct => 'Contests', db->contest_list(%_), 300 },
                sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~&:result~) {
                        forbid $_{private};
-                       response log => 'Job list', {%{db->job_list(%_)}, maybe contest => $_{contest},}, 5
+                       response log => 'Job list', db->job_list(%_), 5
                },
                sub (/pb/  + ?:owner~&:contest~&:private~)                  {
                        forbid $_{private};
                },
                sub (/pb/  + ?:owner~&:contest~&:private~)                  {
                        forbid $_{private};
@@ -173,7 +173,7 @@ sub dispatch_request{
                                forbid !remote_user;
                                $privacy = 'private';
                        }
                                forbid !remote_user;
                                $privacy = 'private';
                        }
-                       response pb_entry => problem->name, {%{db->problem_entry($_{problem}, $_{contest}, remote_user && remote_user->id)}, maybe contest => $_{contest}}, $_{contest} ? 10 : ();
+                       response pb_entry => problem->name, db->problem_entry($_{problem}, $_{contest}, remote_user && remote_user->id), $_{contest} ? 10 : ();
                },
                sub (/sol/:problem) {
                        forbid problem->private;
                },
                sub (/sol/:problem) {
                        forbid problem->private;
index 57b4e50a5f2069bfcde733c0e10fe965ee7d1649..1e0f7889870101de3c74c793ac537e51bfc99b98 100644 (file)
@@ -171,8 +171,8 @@ sub process_pb_entry {
                $tree->fid('nosubmit')->detach;
                $tree->look_down(name => 'problem')->attr(value => $args{id});
                my $contest = $tree->look_down(name => 'contest');
                $tree->fid('nosubmit')->detach;
                $tree->look_down(name => 'problem')->attr(value => $args{id});
                my $contest = $tree->look_down(name => 'contest');
-               $contest->attr(value => $args{contest}) if $args{contest};
-               $contest->detach unless $args{contest}
+               $contest->attr(value => $args{args}{contest}) if $args{args}{contest};
+               $contest->detach unless $args{args}{contest}
        } else {
                $tree->fid('nosubmit')->find('a')->edit_href(sub{s/id/$args{id}/});
                $tree->fid('submit')->detach
        } else {
                $tree->fid('nosubmit')->find('a')->edit_href(sub{s/id/$args{id}/});
                $tree->fid('submit')->detach
@@ -236,7 +236,7 @@ sub process_log {
                my ($data, $tr) = @_;
                $tr->fclass('id')->namedlink($data->{id});
                $tr->fclass('problem')->namedlink($data->{problem}, $data->{problem_name});
                my ($data, $tr) = @_;
                $tr->fclass('id')->namedlink($data->{id});
                $tr->fclass('problem')->namedlink($data->{problem}, $data->{problem_name});
-               $tr->fclass('problem')->find('a')->edit_href(sub{$_ .= "?contest=$args{contest}"}) if $args{contest};
+               $tr->fclass('problem')->find('a')->edit_href(sub{$_ .= "?contest=$args{args}{contest}"}) if $args{args}{contest};
                $tr->fclass('contest')->namedlink($data->{contest}, $data->{contest_name}) if $data->{contest};
                $tr->fclass('contest')->replace_content('None') unless $data->{contest};
                $tr->fclass('date')->replace_content(ftime $data->{date});
                $tr->fclass('contest')->namedlink($data->{contest}, $data->{contest_name}) if $data->{contest};
                $tr->fclass('contest')->replace_content('None') unless $data->{contest};
                $tr->fclass('date')->replace_content(ftime $data->{date});
This page took 0.027249 seconds and 4 git commands to generate.