A boatload of Bugs (#3704)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
ea9b7ad0d1
commit
37734554ba
102 changed files with 2051 additions and 1115 deletions
|
@ -956,6 +956,7 @@ public class ScrobblingService : IScrobblingService
|
|||
// Recalculate the highest volume/chapter
|
||||
foreach (var readEvt in readEvents)
|
||||
{
|
||||
// Note: this causes skewing in the scrobble history because it makes it look like there are duplicate events
|
||||
readEvt.VolumeNumber =
|
||||
(int) await _unitOfWork.AppUserProgressRepository.GetHighestFullyReadVolumeForSeries(readEvt.SeriesId,
|
||||
readEvt.AppUser.Id);
|
||||
|
@ -1027,7 +1028,7 @@ public class ScrobblingService : IScrobblingService
|
|||
_unitOfWork.ScrobbleRepository.Attach(new ScrobbleError()
|
||||
{
|
||||
Comment = "AniList token has expired and needs rotating. Scrobbling wont work until then",
|
||||
Details = $"User: {evt.AppUser.UserName}",
|
||||
Details = $"User: {evt.AppUser.UserName}, Expired: {TokenService.GetTokenExpiry(evt.AppUser.AniListAccessToken)}",
|
||||
LibraryId = evt.LibraryId,
|
||||
SeriesId = evt.SeriesId
|
||||
});
|
||||
|
@ -1124,33 +1125,22 @@ public class ScrobblingService : IScrobblingService
|
|||
private static bool CanProcessScrobbleEvent(ScrobbleEvent readEvent)
|
||||
{
|
||||
var userProviders = GetUserProviders(readEvent.AppUser);
|
||||
if (readEvent.Series.Library.Type == LibraryType.Manga && MangaProviders.Intersect(userProviders).Any())
|
||||
switch (readEvent.Series.Library.Type)
|
||||
{
|
||||
return true;
|
||||
case LibraryType.Manga when MangaProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.Comic when
|
||||
ComicProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.Book when
|
||||
BookProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.LightNovel when
|
||||
LightNovelProviders.Intersect(userProviders).Any():
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.Comic &&
|
||||
ComicProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.Book &&
|
||||
BookProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.LightNovel &&
|
||||
LightNovelProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static IList<ScrobbleProvider> GetUserProviders(AppUser appUser)
|
||||
private static List<ScrobbleProvider> GetUserProviders(AppUser appUser)
|
||||
{
|
||||
var providers = new List<ScrobbleProvider>();
|
||||
if (!string.IsNullOrEmpty(appUser.AniListAccessToken)) providers.Add(ScrobbleProvider.AniList);
|
||||
|
@ -1227,8 +1217,7 @@ public class ScrobblingService : IScrobblingService
|
|||
|
||||
public static string CreateUrl(string url, long? id)
|
||||
{
|
||||
if (id is null or 0) return string.Empty;
|
||||
return $"{url}{id}/";
|
||||
return id is null or 0 ? string.Empty : $"{url}{id}/";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue