fix fill with group when show is also included individually (#1544)

This commit is contained in:
Jason Dove
2024-01-11 10:44:50 -06:00
committed by GitHub
parent 9fd6589831
commit f39eac97c0
8 changed files with 55 additions and 20 deletions
+14 -8
View File
@@ -18,37 +18,43 @@ public class CollectionKey : Record<CollectionKey>
ProgramScheduleItemCollectionType.Collection => new CollectionKey
{
CollectionType = item.CollectionType,
CollectionId = item.CollectionId
CollectionId = item.CollectionId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.TelevisionShow => new CollectionKey
{
CollectionType = item.CollectionType,
MediaItemId = item.MediaItemId
MediaItemId = item.MediaItemId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.TelevisionSeason => new CollectionKey
{
CollectionType = item.CollectionType,
MediaItemId = item.MediaItemId
MediaItemId = item.MediaItemId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.Artist => new CollectionKey
{
CollectionType = item.CollectionType,
MediaItemId = item.MediaItemId
MediaItemId = item.MediaItemId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.MultiCollection => new CollectionKey
{
CollectionType = item.CollectionType,
MultiCollectionId = item.MultiCollectionId
MultiCollectionId = item.MultiCollectionId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.SmartCollection => new CollectionKey
{
CollectionType = item.CollectionType,
SmartCollectionId = item.SmartCollectionId
SmartCollectionId = item.SmartCollectionId,
FakeCollectionKey = item.FakeCollectionKey
},
ProgramScheduleItemCollectionType.FakeCollection => new CollectionKey
{
CollectionType = item.CollectionType,
FakeCollectionKey = item.FakeCollectionKey
CollectionType = item.CollectionType,
FakeCollectionKey = item.FakeCollectionKey
},
_ => throw new ArgumentOutOfRangeException(nameof(item))
};
+14 -4
View File
@@ -447,7 +447,15 @@ public class PlayoutBuilder : IPlayoutBuilder
_televisionRepository,
_artistRepository,
collectionKey);
var fakeCollections = _mediaCollectionRepository.GroupIntoFakeCollections(mediaItems)
string collectionKeyString = JsonConvert.SerializeObject(
collectionKey,
Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
collectionKeyString = $"{scheduleItem.Id}:{collectionKeyString}";
var fakeCollections = _mediaCollectionRepository.GroupIntoFakeCollections(mediaItems, collectionKeyString)
.Filter(c => c.ShowId > 0 || c.ArtistId > 0 || !string.IsNullOrWhiteSpace(c.Key))
.ToList();
List<ProgramScheduleItem> fakeScheduleItems = [];
@@ -465,17 +473,19 @@ public class PlayoutBuilder : IPlayoutBuilder
var (showId, _, _) when showId > 0 => new CollectionKey
{
CollectionType = ProgramScheduleItemCollectionType.TelevisionShow,
MediaItemId = showId
MediaItemId = showId,
FakeCollectionKey = collectionKeyString
},
var (_, artistId, _) when artistId > 0 => new CollectionKey
{
CollectionType = ProgramScheduleItemCollectionType.Artist,
MediaItemId = artistId
MediaItemId = artistId,
FakeCollectionKey = collectionKeyString
},
var (_, _, k) when k is not null => new CollectionKey
{
CollectionType = ProgramScheduleItemCollectionType.FakeCollection,
FakeCollectionKey = k
FakeCollectionKey = collectionKeyString
},
var (_, _, _) => null
};