Improved logging for import errors
This commit is contained in:
parent
c8c0ffeb0d
commit
5caa9c5687
6 changed files with 44 additions and 24 deletions
|
|
@ -121,9 +121,7 @@ namespace DtoImporterService
|
|||
: item.Categories[1].CategoryId;
|
||||
|
||||
// This should properly be SingleOrDefault() not FirstOrDefault(), but FirstOrDefault is defensive
|
||||
var category
|
||||
= DbContext.Categories.Local.FirstOrDefault(c => c.AudibleCategoryId == lastCategory)
|
||||
?? Category.GetEmpty();
|
||||
var category = DbContext.Categories.Local.FirstOrDefault(c => c.AudibleCategoryId == lastCategory);
|
||||
|
||||
Book book;
|
||||
try
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ namespace DtoImporterService
|
|||
|
||||
private void loadLocal_categories(List<string> categoryIds)
|
||||
{
|
||||
// must include default/empty/missing
|
||||
categoryIds.Add(Category.GetEmpty().AudibleCategoryId);
|
||||
|
||||
var localIds = DbContext.Categories.Local.Select(c => c.AudibleCategoryId).ToList();
|
||||
var remainingCategoryIds = categoryIds
|
||||
.Distinct()
|
||||
|
|
@ -42,10 +45,8 @@ namespace DtoImporterService
|
|||
.ToList();
|
||||
|
||||
// load existing => local
|
||||
// remember to include default/empty/missing
|
||||
var emptyName = Contributor.GetEmpty().Name;
|
||||
if (remainingCategoryIds.Any())
|
||||
DbContext.Categories.Where(c => remainingCategoryIds.Contains(c.AudibleCategoryId) || c.Name == emptyName).ToList();
|
||||
DbContext.Categories.Where(c => remainingCategoryIds.Contains(c.AudibleCategoryId)).ToList();
|
||||
}
|
||||
|
||||
// only use after loading contributors => local
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue