Fixed: Remove Collection on last Movie delete

This commit is contained in:
Qstick 2022-05-30 22:06:23 -05:00
parent 5dc541c69e
commit 737a0176d4
1 changed files with 6 additions and 6 deletions

View File

@ -21,13 +21,13 @@ namespace NzbDrone.Core.Movies.Collections
public class MovieCollectionService : IMovieCollectionService, IHandleAsync<MoviesDeletedEvent>
{
private readonly IMovieCollectionRepository _repo;
private readonly IMovieMetadataService _movieMetadataService;
private readonly IMovieService _movieService;
private readonly IEventAggregator _eventAggregator;
public MovieCollectionService(IMovieCollectionRepository repo, IMovieMetadataService movieMetadataService, IEventAggregator eventAggregator)
public MovieCollectionService(IMovieCollectionRepository repo, IMovieService movieService, IEventAggregator eventAggregator)
{
_repo = repo;
_movieMetadataService = movieMetadataService;
_movieService = movieService;
_eventAggregator = eventAggregator;
}
@ -96,16 +96,16 @@ namespace NzbDrone.Core.Movies.Collections
foreach (var collectionTmdbId in collections)
{
if (collectionTmdbId == 0 || _movieMetadataService.GetMoviesByCollectionTmdbId(collectionTmdbId).Any())
if (collectionTmdbId == 0 || _movieService.GetMoviesByCollectionTmdbId(collectionTmdbId).Any())
{
continue;
}
var collection = FindByTmdbId(collectionTmdbId);
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));
_repo.Delete(collectionTmdbId);
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));
}
}