From adb44605971dd30c3ea7eb753928277deac92816 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 31 Jan 2014 15:21:19 +0200 Subject: [PATCH] Do not depend on Gruntmaster::Page anymore --- lib/Gruntmaster/Daemon.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index c3ee591..5c5c19e 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -9,7 +9,6 @@ our $VERSION = '0.001'; use Gruntmaster::Daemon::Constants qw/ERR/; use Gruntmaster::Daemon::Format qw/mkrun/; use Gruntmaster::Data; -use Gruntmaster::Page::Log; use File::Basename qw/fileparse/; use File::Slurp qw/write_file/; @@ -23,6 +22,8 @@ use Try::Tiny; use YAML::Any qw/LoadFile DumpFile/; use Log::Log4perl qw/get_logger/; +use constant PAGE_SIZE => 10; + ################################################## sub safe_can_nodie { @@ -75,7 +76,7 @@ sub process{ $meta = job_inmeta $job; if (job_problem $job) { my $pbmeta = problem_meta job_problem $job; - my %files = %{$meta->{files}}; + my %files = exists $meta->{files} ? %{$meta->{files}} : (); $meta = {%$meta, %$pbmeta}; $meta->{files} = {%files, %{$pbmeta->{files}}} if exists $pbmeta->{files}; } @@ -130,11 +131,12 @@ sub process{ set_job_errors $job, $errors; my $log = $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest/log" : 'log'; - PUBLISH gensrc => "$Gruntmaster::Data::contest.$job"; + + PUBLISH gensrc => ($Gruntmaster::Data::contest // '') . ".$job"; PUBLISH genpage => "$log/job/$job.html"; PUBLISH genpage => "$log/index.html"; PUBLISH genpage => "$log/st.html"; - my $page = ($job + Gruntmaster::Page::Log::PAGE_SIZE - 1) / Gruntmaster::Page::Log::PAGE_SIZE; + my $page = ($job + PAGE_SIZE - 1) / PAGE_SIZE; PUBLISH genpage => "$log/@{[$page - 1]}.html"; PUBLISH genpage => "$log/$page.html"; PUBLISH genpage => "$log/@{[$page + 1]}.html"; -- 2.39.2