Skip to content
Snippets Groups Projects
Commit c57bb398 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'hotline#77976_lien_hypertexte_sur_les_auteurs' into 'hotline'

hotline #77976 : enhance author detection in analytics

See merge request !2756
parents 42b0dd71 dc9c73a4
Branches
Tags
4 merge requests!2806Master,!2776Master,!2772Hotline,!2756hotline #77976 : enhance author detection in analytics
Pipeline #4714 passed with stage
in 47 minutes and 54 seconds
- ticket #77976 : Vue notice : Amélioration de la détection des auteurs dans le bloc des dépouillements
\ No newline at end of file
......@@ -52,14 +52,11 @@ class Class_Onglet_AnalyticsItem {
public function acceptAuthorVisitor($author, $visitor) {
if (!preg_match('/([\w\s&]+)(\s*,\s*([\w-]+))?/u', $author, $matches))
if (!preg_match('/([\w\s&]+)(\s*,\s*([\w\s-]+))?/u', $author, $matches))
return $visitor->visitAuthor($author);
$visitor->visitAuthorLastNameFirstName($author,
$matches[1],
isset($matches[3]) ? $matches[3] : '');
trim($matches[1]),
isset($matches[3]) ? trim($matches[3]) : '');
}
}
?>
\ No newline at end of file
......@@ -31,7 +31,9 @@ class Class_Onglet_AnalyticsItemTest extends ModelTestCase {
[ 'Godard, Jean-Luc' , 'Godard', 'Jean-Luc' ],
[ 'Abba' , 'Abba', '' ],
[ 'Kool & Gang' , 'Kool & Gang', '' ],
[ 'Village People' , 'Village People', '' ]
[ 'Village People' , 'Village People', '' ],
[ 'Ponfilly, Christophe de', 'Ponfilly', 'Christophe de' ],
[ 'Van Cauwelaert, Didier (1960-....)', 'Van Cauwelaert', 'Didier'],
];
}
......@@ -45,18 +47,21 @@ class Class_Onglet_AnalyticsItemTest extends ModelTestCase {
$item->addAuthor($author);
$item->acceptVisitor($this);
$this->assertEquals([$lastname, $firstname], [$this->_lastname, $this->_firstname]);
$this->assertEquals($lastname, $this->_lastname);
$this->assertEquals($firstname, $this->_firstname);
}
public function visitAuthor($author) {}
public function visitAuthor($author) {
}
public function visitAuthorLastNameFirstName($author, $lastname, $firstname) {
$this->_lastname = $lastname;
$this->_firstname = $firstname;
}
public function visitTitle($title) {}
public function visitTitle($title) {
}
}
?>
\ No newline at end of file
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