Browse Source

fix updating trakt lists (#1218)

pull/1219/head
Jason Dove 2 years ago committed by GitHub
parent
commit
46034aff54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 2
      ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs
  3. 6
      ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs

2
CHANGELOG.md

@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix updating (re-adding) Trakt lists to properly use new metadata ids that were not present when originally added
## [0.7.6-beta] - 2023-03-24
### Added

2
ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs

@ -61,7 +61,7 @@ public class AddTraktListHandler : TraktCommandBase, IRequestHandler<AddTraktLis @@ -61,7 +61,7 @@ public class AddTraktListHandler : TraktCommandBase, IRequestHandler<AddTraktLis
private async Task<Either<BaseError, Unit>> DoAdd(Parameters parameters)
{
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync();
return await TraktApiClient.GetUserList(parameters.User, parameters.List)
.BindT(list => SaveList(dbContext, list))

6
ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs

@ -87,7 +87,11 @@ public abstract class TraktCommandBase @@ -87,7 +87,11 @@ public abstract class TraktCommandBase
foreach (TraktListItem existing in toUpdate)
{
Option<TraktListItem> maybeIncoming = list.Items.Find(i => i.TraktId == existing.TraktId);
Option<TraktListItem> maybeIncoming = items
.Filter(i => i.TraktId == existing.TraktId)
.Map(i => ProjectItem(list, i))
.HeadOrNone();
foreach (TraktListItem incoming in maybeIncoming)
{
existing.Kind = incoming.Kind;

Loading…
Cancel
Save