Skip to content

Commit

Permalink
[import] Fix comma in role
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Dec 13, 2024
1 parent dbc18c3 commit d3615db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Helpers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ function convertEmptyStringsToNull($array) {
}

function formatName($name) {
return preg_replace('/^([^,]*),\s*(.*)$/', '$2 $1', $name);
return preg_replace('/^([^,]*),\s*(.*)$/', '$2 $1', $name);
}

function starts_with_upper($str) {
Expand Down
2 changes: 1 addition & 1 deletion app/Importers/UpmImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function hydrateAuthor(array $record): string
return $author;
}

return sprintf('%s (%s)', formatName($matches['name']), $matches['role']);
return sprintf('%s – %s', formatName($matches['name']), $matches['role']);
})
->join('; ');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Importers/UpmImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testImport()
$item = Item::find('CZE:UPM.GK_11090');

$this->assertEquals('GK 11090/E', $item->identifier);
$this->assertEquals('Luboš Kopáč (návrh vazby)', $item->author);
$this->assertEquals('Jiří Rathouský – grafická úprava, design vazby a přebalu', $item->author);
$this->assertEquals(1928, $item->date_earliest);
$this->assertEquals(1928, $item->date_latest);
$this->assertEquals('1986', $item->acquisition_date);
Expand Down Expand Up @@ -89,7 +89,7 @@ private function fakeData(array $overrides = []): array
"ID" => "GK_11090",
"Název" => "Vazba knihy",
"Název EN" => "Binding design",
"Autor" => "Kopáč, Lubošnávrh vazby",
"Autor" => "Rathouský, Jiřígrafická úprava, design vazby a přebalu",
"Vznik" => "Praha;VŠUP atelier V.H.Brunnera (vazba)",
"Datace" => "1928",
"Od" => "1928",
Expand Down

0 comments on commit d3615db

Please sign in to comment.