Skip to content

Commit

Permalink
[import] add comma after author's surname
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Dec 20, 2024
1 parent 2ff4a46 commit f4d572e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/Importers/MmpImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ protected function hydrateAuthor(array $record): string
return 'Neznámy autor';
}

return $record['Autor'];
return str($record['Autor'])
->trim()
->replaceMatches('/(.*?) /', '$1, ', 1);
}

protected function hydrateWorkType(array $record, string $locale): ?string
Expand Down
4 changes: 2 additions & 2 deletions tests/Importers/MmpImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testImport()
$item = Item::find('CZE:MP.H_014_487');

$this->assertEquals('H 014 487', $item->identifier);
$this->assertEquals('Neznámy autor', $item->author);
$this->assertEquals('Beisch, Josef Antonín', $item->author);
$this->assertEquals(1701, $item->date_earliest);
$this->assertEquals(1800, $item->date_latest);
$this->assertEquals('Panna Marie Karlovská', $item->title);
Expand Down Expand Up @@ -81,7 +81,7 @@ private function fakeData(array $overrides = []): array
"Řada" => "H",
"Inventární číslo" => "H 014 487",
"Titul" => "Panna Marie Karlovská",
"Autor" => "Anonym",
"Autor" => "Beisch Josef Antonín",
"Datace vzniku" => "počátek 18.stol.",
"(n) Datace OD" => "1.1.1701",
"(n) Datace DO" => "31.12.1800",
Expand Down

0 comments on commit f4d572e

Please sign in to comment.