Bugfix. Audible changed how they handle categories, causing a new bug. Temp fix to get everything working again -- part 2
This commit is contained in:
parent
a8b9e187e6
commit
c54c45df33
@ -86,8 +86,16 @@ namespace DtoImporterService
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// categories are laid out for a breadcrumb. category is 1st, subcategory is 2nd
|
// categories are laid out for a breadcrumb. category is 1st, subcategory is 2nd
|
||||||
// absence of categories is very rare, but possible
|
// absence of categories is also possible
|
||||||
var lastCategory = item.Categories.LastOrDefault()?.CategoryId ?? "";
|
|
||||||
|
// CATEGORY HACK: only use the 1st 2 categories
|
||||||
|
// (real impl: var lastCategory = item.Categories.LastOrDefault()?.CategoryId ?? "";)
|
||||||
|
var lastCategory
|
||||||
|
= item.Categories.Length == 0 ? ""
|
||||||
|
: item.Categories.Length == 1 ? item.Categories[0].CategoryId
|
||||||
|
// 2+
|
||||||
|
: item.Categories[1].CategoryId;
|
||||||
|
|
||||||
var category = DbContext.Categories.Local.SingleOrDefault(c => c.AudibleCategoryId == lastCategory);
|
var category = DbContext.Categories.Local.SingleOrDefault(c => c.AudibleCategoryId == lastCategory);
|
||||||
|
|
||||||
var book = DbContext.Books.Add(new Book(
|
var book = DbContext.Books.Add(new Book(
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace DtoImporterService
|
|||||||
{
|
{
|
||||||
for (var i = 0; i < pair.Length; i++)
|
for (var i = 0; i < pair.Length; i++)
|
||||||
{
|
{
|
||||||
// not yet supported: depth beyond 0 and 1
|
// CATEGORY HACK: not yet supported: depth beyond 0 and 1
|
||||||
if (i > 1)
|
if (i > 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
||||||
<Version>3.1.10.1</Version>
|
<Version>3.1.11.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user