fix fill with group when show is also included individually (#1544)
This commit is contained in:
@@ -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))
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user