Skip to content
Snippets Groups Projects
Commit 35238a98 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

waiting tasks count and helper refacto

parent a6a1bbd8
6 merge requests!2080Sandbox detach zf from storm,!1922Master,!1921Hotline master,!1920Master,!1910Dev bloc info integration,!1905Dev bloc info integration
......@@ -26,31 +26,53 @@ class ZendAfi_View_Helper_Admin_CosmoStatus extends ZendAfi_View_Helper_BaseHelp
public function cosmoStatus() {
$date_integration = Class_CosmoVar::getValueOf('integration_date');
$html = $this->_tag('h2', $this->_('Intégration des données : '))
. $this->view->ligneInfos($this->_('Dernier traitement d\'intégration effectué le'),
Class_Date::getHumanDate($date_integration, 'd MMMM yyyy'));
return $this->title()
. $this->lastRun($date_integration)
. $this->currentRun()
. $this->lag($date_integration)
. $this->tasksWaiting();
}
if ('1' == Class_CosmoVar::getValueOf('clef_traitements')) {
$html .= $this->view->ligneInfos($this->_('La base est bloquée - phase de traitement'),
Class_CosmoVar::getValueOf('traitement_phase'));
}
$ecart = $this->getTimeSource()->daysFrom(strtotime($date_integration));
protected function title() {
return $this->_tag('h2', $this->_('Intégration des données : '));
}
protected function lastRun($date_integration) {
return $this->info($this->_('Dernier traitement d\'intégration effectué le'),
Class_Date::getHumanDate($date_integration, 'd MMMM yyyy'));
}
protected function currentRun() {
return '1' == Class_CosmoVar::getValueOf('clef_traitements')
? $this->info($this->_('La base est bloquée - phase de traitement'),
Class_CosmoVar::getValueOf('traitement_phase'))
: '';
}
protected function lag($date_integration) {
$ecart = $this->getTimeSource()->daysFrom(strtotime($date_integration));
$frequence = (int)Class_CosmoVar::getValueOf('integration_frequence');
if (0 < $frequence && $frequence < $ecart) {
$html .= $this->view->ligneInfos($this->_('Les traitements d\'intégration n\'ont pas été effectués depuis'),
$this->_('%s jours', $ecart));
}
return $html;
/*
//---------------------------------------------------------------------------------
// Nombre de fichiers en attente
//---------------------------------------------------------------------------------
$nombre=$sql->fetchOne("select count(*) from integrations where traite = 'non'");
if($nombre == 0) afficherLigne(false,"Tous les fichiers en attente ont été intégrés.");
else afficherLigne(false,"Il reste " . $nombre . " fichier(s) en attente d'intégration.");
*/
return 0 < $frequence && $frequence < $ecart
? $this->info($this->_('Les traitements d\'intégration n\'ont pas été effectués depuis'),
$this->_('%s jours', $ecart))
: '';
}
protected function tasksWaiting() {
$count = Class_Cosmogramme_Integration::countBy(['traite' => 'non']);
return $this->info($this->_('Fichier(s) en file d\'attente'),
$count ? $count : $this->_('aucun'));
}
protected function info($label, $value) {
return $this->view->ligneInfos($label, $value);
}
}
\ No newline at end of file
......@@ -143,6 +143,12 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
}
/** @test */
public function integrationWaitingTasksShouldBePresent() {
$this->assertXPathContentContains('//div[contains(text(), "Fichier(s) en file d\'attente")]//b', 'aucun');
}
/** @test */
public function editDomaineNameLinkShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "/admin/index/adminvaredit/cle/NOM_DOMAINE")]','Modifier', $this->_response->getBody());
......
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