Scanner Bugfixes (#2818)

This commit is contained in:
Joe Milazzo 2024-03-25 16:28:10 -05:00 committed by GitHub
parent 829a610579
commit 93a8883fe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 180 additions and 99 deletions

View file

@ -129,6 +129,35 @@ public static class MigrateMixedSpecials
//UpdateCoverImage(directoryService, logger, specialChapter, extension, newVolume);
}
var oldVolumeBookmarks = await dataContext.AppUserBookmark
.Where(p => p.VolumeId == distinctVolume.Volume.Id).ToListAsync();
logger.LogInformation("Moving {Count} existing Bookmarks from Volume Id {OldVolumeId} to New Volume {NewVolumeId}",
oldVolumeBookmarks.Count, distinctVolume.Volume.Id, newVolume.Id);
foreach (var bookmark in oldVolumeBookmarks)
{
bookmark.VolumeId = newVolume.Id;
}
var oldVolumePersonalToC = await dataContext.AppUserTableOfContent
.Where(p => p.VolumeId == distinctVolume.Volume.Id).ToListAsync();
logger.LogInformation("Moving {Count} existing Personal ToC from Volume Id {OldVolumeId} to New Volume {NewVolumeId}",
oldVolumePersonalToC.Count, distinctVolume.Volume.Id, newVolume.Id);
foreach (var pToc in oldVolumePersonalToC)
{
pToc.VolumeId = newVolume.Id;
}
var oldVolumeReadingListItems = await dataContext.ReadingListItem
.Where(p => p.VolumeId == distinctVolume.Volume.Id).ToListAsync();
logger.LogInformation("Moving {Count} existing Personal ToC from Volume Id {OldVolumeId} to New Volume {NewVolumeId}",
oldVolumeReadingListItems.Count, distinctVolume.Volume.Id, newVolume.Id);
foreach (var readingListItem in oldVolumeReadingListItems)
{
readingListItem.VolumeId = newVolume.Id;
}
await dataContext.SaveChangesAsync();
}