Skip to content
Snippets Groups Projects
Commit 6f5c3541 authored by lbrun's avatar lbrun
Browse files

hotline #37359 : mooderation_avis_les_nombres_d_avis_a_moderer_sont_inexacts

fix display orphan opinions
parent de532da4
Branches
Tags
10 merge requests!1587Master,!1553Master,!1519Master,!1502Master,!1501Stable,!1491Master,!1490Hotline master,!1472Stable,!1468Stable,!1467Hotline#37359 mooderation avis les nombres d avis a moderer sont inexacts
- ticket #37359 : Correction affichage moderation : les nombres d'avis à moderer sont inexacts
\ No newline at end of file
......@@ -47,8 +47,7 @@ class AvisNoticeLoader extends Storm_Model_Loader {
public function findOrphanReviews($status, $limitPage) {
return self::findReviews($status,
$limitPage,
Class_AvisNotice::ORPHAN_FLAG,
null);
Class_AvisNotice::ORPHAN_FLAG);
}
......@@ -71,17 +70,20 @@ class AvisNoticeLoader extends Storm_Model_Loader {
public function findArchivedReviews($status,$limitPage) {
return self::findReviews($status,
$limitPage,
Class_AvisNotice::ARCHIVED_FLAG,
null);
Class_AvisNotice::ARCHIVED_FLAG);
}
protected function findReviews($status, $limit_page, $flag, $avis) {
return Class_AvisNotice::findAllBy(['flags' => $flag,
'abon_ou_bib' => $avis,
'order' => 'date_avis desc',
'statut' => $status,
'limitPage' => $limit_page]);
protected function findReviews($status, $limit_page, $flag, $avis = null) {
$params = ['flags' => $flag,
'order' => 'date_avis desc',
'statut' => $status,
'limitPage' => $limit_page];
if ($avis !== null)
$params['abon_ou_bib'] = $avis;
return Class_AvisNotice::findAllBy($params);
}
......@@ -101,22 +103,24 @@ class AvisNoticeLoader extends Storm_Model_Loader {
public function countOrphanReviews($status) {
return self::countReviews($status,
Class_AvisNotice::ORPHAN_FLAG,
null);
Class_AvisNotice::ORPHAN_FLAG);
}
public function countArchivedReviews($status) {
return self::countReviews($status,
Class_AvisNotice::ARCHIVED_FLAG,
null);
Class_AvisNotice::ARCHIVED_FLAG);
}
protected function countReviews($status, $flag, $avis) {
return Class_AvisNotice::countBy(['statut' => $status,
'flags' => $flag,
'abon_ou_bib' => $avis]);
protected function countReviews($status, $flag, $avis = null) {
$params = ['flags' => $flag,
'statut' => $status];
if ($avis !== null)
$params['abon_ou_bib'] = $avis;
return Class_AvisNotice::countBy($params);
}
......
......@@ -637,6 +637,18 @@ class ModoControllerAvisnoticeActionTest extends Admin_AbstractControllerTestCas
public function setup() {
parent::setup();
$this->fixture('Class_AvisNotice', ['id' => 622,
'id_notice' => 1002,
'entete' => 'Orphan Test',
'note'=> 2,
'id_user' => null,
'flags' => 1,
'avis' => 'Un bon livre !',
'id_notice' => 1032,
'statut' => 0,
'abon_ou_bib' => 1]);
$this->dispatch('admin/modo/avisnotice', true);
}
......@@ -654,8 +666,14 @@ class ModoControllerAvisnoticeActionTest extends Admin_AbstractControllerTestCas
/** @test **/
public function avisnoticeShouldContainsOrphanFlag() {
$this->assertXpathContentContains('//div//h2', 'Avis orphelins', $this->_response->getBody());
public function avisnoticeShouldContainsOrphanFlagWithOnOpinion() {
$this->assertXpathContentContains('//div//h2', 'Avis orphelins (1)', $this->_response->getBody());
}
/** @test */
public function avisnoticeShouldContainsOneOpinion() {
$this->assertXPathContentContains('//div[@class="critique"]//a[contains(@href, "blog/viewavis/id/622")]', "Orphan Test",$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