diff --git a/src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php b/src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php index 81146bc..7593cb4 100644 --- a/src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php +++ b/src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php @@ -453,14 +453,40 @@ class IHMJobsManagerClass { $jobstatus = $this->getJobStatus($running,$exitcode); $job->setAttribute('status', $jobstatus); + $infos = []; + if ($running) $job->setAttribute('stop', 'unknown'); else if ($job->getAttribute('stop') == '' || $job->getAttribute('stop') == 'unknown') { $job->setAttribute('stop', date('d-m-Y H:i:s', time())); + + $res_dir = USERWORKINGDIR . $job->getAttribute('folder') . '/'; + $fileSize = filesize ( glob($res_dir.'/' . $job->getAttribute('result') . '.*')[0]); + if ($fileSize < 1024) { + $strSize = number_format($fileSize, 2, '.', ' ') . 'b'; + } else if($fileSize < 1024*1024) { + $strSize = number_format($fileSize/1024, 2, '.', ' ') . 'kb'; + } else if($fileSize < 1024*1024*1024) { + $strSize = number_format($fileSize/(1024*1024), 2, '.', ' ') . 'mb'; + } else { + $strSize = number_format($fileSize/(1024*1024*1024), 2, '.', ' ') . 'gb'; + } + $infos['File size'] = $strSize; + + $start = new DateTime($job->getAttribute('start')); + $interval = (new DateTime('now'))->diff($start); + $infos['Job duration'] = $interval->format('%Hh %Im %Ss'); + $this->jobXml->getElementById($this->resRootNode[$job->getAttribute('jobType')])->appendChild($job); } - + + $strInfo = $job->getAttribute('info'); + foreach ($infos as $key => $info) { + $strInfo .= '<b>' . $key . '</b>: ' . $info . '<br/>'; + } + $job->setAttribute('info', $strInfo); + $res = $this->jobXml->save($this->jobXmlName); if (!$res) -- libgit2 0.21.2