Commit 038ed506 authored by efalcy's avatar efalcy
Browse files

hotline #78216 : add tags rubrique

parent b0ebde0d
Pipeline #4703 failed with stage
in 44 minutes and 53 seconds
......@@ -304,6 +304,7 @@ class Class_WebService_BibNumerique_RessourceNumerique {
Class_Album::clearCache();
Class_AlbumRessource::clearCache();
return $album;
}
......
......@@ -56,7 +56,7 @@ class Class_WebService_BibNumerique_ToutApprendre extends Class_WebService_BibNu
$ids = [];
foreach($this->_albums as $album)
$ids []= $album->getIdOrigine();
if (is_empy($ids))
if (empty($ids))
return ;
Class_Album::deleteBy(['where' => 'url_origine="'.self::BASE_URL.'" and id_origine not in (\''. implode("', '", $ids) . '\')']);
......
......@@ -95,11 +95,17 @@ class Class_WebService_BibNumerique_ToutApprendre_CatalogueParser {
$this->_current_formation->setEditeur($data);
}
public function endTheme($data) {
$this->_current_formation->addTag($data);
}
public function endRubrique($data) {
$this->_current_formation->addTag($data);
}
public function endDureeCours($data) {
$this->_current_formation->setDuration($data);
}
......
......@@ -31,7 +31,7 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
->setAnnee($this->getAnnee())
->setDuration($this->_duration)
->setDescription($this->getDescription())
->setTags(implode(';',array_filter(array_merge(explode(';',$album->getTags()),$this->_tags))));;
->setTags($this->mergeTags($album->getTags()));
}
......@@ -45,6 +45,12 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
}
public function mergeTags($tags) {
return implode(';',array_unique(
array_filter(
array_merge(explode(';',$tags),$this->_tags))));
}
public function addTag($tag) {
$this->_tags[] = $tag;
}
......@@ -53,5 +59,12 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
public function setDuration($text) {
$this->_duration = $text;
}
protected function updateAlbum($album) {
$album->setTags($this->mergeTags($tags));
return parent::updateAlbum($album);
}
}
?>
\ No newline at end of file
......@@ -141,8 +141,8 @@ class ToutApprendreTest extends ModelTestCase {
/** @test */
public function tagsShouldBeImportAsTheme() {
$this->assertEquals('Tableur / Excel',$this->_first_album->getTags());
public function tagsShouldBeImportAsThemeAndRubrique() {
$this->assertEquals('Multimedia;Tableur / Excel',$this->_first_album->getTags());
}
......@@ -152,7 +152,6 @@ class ToutApprendreTest extends ModelTestCase {
}
/** @test */
public function oldRessourceShouldHaveBeenDelete() {
$old_resource = $this->fixture('Class_AlbumRessource',
......
Markdown is supported
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