Skip to content
Snippets Groups Projects
Commit 5c7b2b9d authored by Laurent's avatar Laurent
Browse files

hotline #55142 WIP new cosmo integration logs screen

parent 25ba36a8
Branches
Tags
2 merge requests!2334Master,!2133Hotline#55142 1 dtouch
Pipeline #1325 failed with stage
in 11 minutes and 55 seconds
......@@ -50,6 +50,15 @@ class LogsControllerTest extends CosmoControllerTestCase {
'nb_erreurs' => 0,
'nb_warnings' => 7,
]);
$this->fixture('Class_Cosmogramme_Integration',
['id' => 2,
'pointeur_reprise' => 234,
'traite' => '2017-05-12',
'nb_erreurs' => 2,
'nb_warnings' => 1,
]);
$this->dispatch('/cosmo/logs', true);
}
......@@ -74,6 +83,12 @@ class LogsControllerTest extends CosmoControllerTestCase {
}
/** @test */
public function firstTRRecordProcessedShouldContainsZero() {
$this->assertXPath('//tr[1]/td[4][text()="0"]');
}
/** @test */
public function secondTRShouldContainsFridayTwelveMay2017() {
$this->assertXPathContentContains('//table[@id="logs"]//tr[2]//td',
......@@ -98,5 +113,24 @@ class LogsControllerTest extends CosmoControllerTestCase {
$this->assertXPathContentContains('//tr[2]//td//a[contains(@href, "/cosmo/logs/debug/day/2017-05-12")]',
'2 Ko');
}
/** @test */
public function secondTRRecordProcessedShouldContains235() {
$this->assertXPath('//tr[2]/td[4][text()="235"]');
}
/** @test */
public function secondTRErrorsShouldContains2() {
$this->assertXPath('//tr[2]/td[5][text()="2"]');
}
/** @test */
public function secondTRWarningsShouldContains8() {
$this->assertXPath('//tr[2]/td[6][text()="8"]');
}
}
?>
\ No newline at end of file
......@@ -35,7 +35,16 @@ class ZendAfi_View_Helper_CosmoLogs extends ZendAfi_View_Helper_BaseHelper {
['callback' => [$this, 'renderReport']])
->addColumn($this->_('Debug'),
['callback' => [$this, 'renderDebugLog']]);
['callback' => [$this, 'renderDebugLog']])
->addColumn($this->_('Notices traitées'),
['callback' => [$this, 'renderProcessedRecords']])
->addColumn($this->_('Erreurs'),
['callback' => [$this, 'renderErrors']])
->addColumn($this->_('Anomalies'),
['callback' => [$this, 'renderWarnings']]);
return $this->view->renderTable($table, $this->_getDays());
}
......@@ -57,6 +66,21 @@ class ZendAfi_View_Helper_CosmoLogs extends ZendAfi_View_Helper_BaseHelper {
}
public function renderProcessedRecords($day) {
return $day->getProcessedRecords();
}
public function renderErrors($day) {
return $day->getErrors();
}
public function renderWarnings($day) {
return $day->getWarnings();
}
public function renderReport($day) {
return
$this->view
......@@ -117,11 +141,21 @@ class ZendAfi_View_Helper_CosmoLogs extends ZendAfi_View_Helper_BaseHelper {
'$1',
$filename);
$integrations = new Storm_Model_Collection(
Class_Cosmogramme_Integration::findAllBy(['traite' => $day]));
$sum_all = function($field) use ($integrations) {
return array_sum($integrations->collect($field)->getArrayCopy());
};
return (new Class_Entity())
->setDay($day)
->setHumanDate(strftime('%A %e %B %Y', strtotime($day)))
->setIntegrationSize($this->_getFileSize($filename))
->setDebugSize($this->_getFileSize(str_replace('integration', 'debug', $filename)));
->setDebugSize($this->_getFileSize(str_replace('integration', 'debug', $filename)))
->setProcessedRecords($sum_all('pointeur_reprise'))
->setErrors($sum_all('nb_erreurs'))
->setWarnings($sum_all('nb_warnings'));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment