Skip to content

Commit

Permalink
Fixed issue with Sangatsu manga
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Lehtinen committed Feb 9, 2023
1 parent 7aef1cb commit f000217
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Groschen.php
Original file line number Diff line number Diff line change
Expand Up @@ -1538,15 +1538,17 @@ public function getSupportingResources()
throw new Exception($json->loginFaultMessage);
}

// Compile list of Elvis queries
// Brand mapping
$brand = ($this->product->brand->name === 'Sangatsu Manga') ? 'Tammi' : $this->product->brand->name;

// Cover image
$queries = [
'gtin:' . $this->productNumber . ' AND cf_catalogMediatype:cover AND ancestorPaths:"/'.$this->product->brand->name.'/Kansikuvat"'
'gtin:' . $this->productNumber . ' AND cf_catalogMediatype:cover AND ancestorPaths:"/'.$brand.'/Kansikuvat"'
];

// Add separate queries for each contributor
foreach ($this->getContributors() as $contributor) {
array_push($queries, 'cf_mockingbirdContactId:' . $contributor['Identifier'] . ' AND cf_preferredimage:true AND cf_availableinpublicweb:true AND ancestorPaths:"/'.$this->product->brand->name.'/Kirjailijakuvat"');
array_push($queries, 'cf_mockingbirdContactId:' . $contributor['Identifier'] . ' AND cf_preferredimage:true AND cf_availableinpublicweb:true AND ancestorPaths:"/'.$brand.'/Kirjailijakuvat"');
}

// List of metadata fields from Elvis that we need
Expand Down
10 changes: 10 additions & 0 deletions tests/GroschenIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,16 @@ public function testGettingSupportingResourcesWithMultipleImages()
$this->assertGreaterThan(0, $groschen->getSupportingResources()->count());
}

/**
* Test getting supporting resources for Sangatsu Manga
* @return void
*/
public function testGettingSupportingResourcesForSangatsuManga()
{
$groschen = new Groschen('9789521621338');
$this->assertGreaterThan(0, $groschen->getSupportingResources()->count());
}

/**
* Test getting Bazar 3D cover image
* @group SupportingResources
Expand Down

0 comments on commit f000217

Please sign in to comment.