From 7c2eff13811bdaf5437aba74f690f936aef551d2 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Wed, 1 Jul 2026 18:39:08 -0500 Subject: [PATCH] fix shuffle_sequence instruction handler --- .../Handlers/YamlPlayoutShuffleSequenceHandler.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutShuffleSequenceHandler.cs b/ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutShuffleSequenceHandler.cs index 707ea8139..b0fab7f7a 100644 --- a/ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutShuffleSequenceHandler.cs +++ b/ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutShuffleSequenceHandler.cs @@ -28,7 +28,9 @@ public class YamlPlayoutShuffleSequenceHandler : IYamlPlayoutHandler string sequenceKey = shuffleSequenceInstruction.ShuffleSequence; - var groupedSequenceItems = context.Definition.Playout + List playout = context.CurrentInstructions; + + var groupedSequenceItems = playout .Where(i => i.SequenceKey == sequenceKey) .GroupBy(i => i.SequenceGuid) .ToList(); @@ -43,9 +45,9 @@ public class YamlPlayoutShuffleSequenceHandler : IYamlPlayoutHandler shuffledGroup = grouping.OrderBy(_ => Guid.NewGuid()).ToList(); } - int firstIndex = context.Definition.Playout.FindIndex(i => i.SequenceGuid == grouping.Key); - context.Definition.Playout.RemoveRange(firstIndex, shuffledGroup.Count); - context.Definition.Playout.InsertRange(firstIndex, shuffledGroup); + int firstIndex = playout.FindIndex(i => i.SequenceGuid == grouping.Key); + playout.RemoveRange(firstIndex, shuffledGroup.Count); + playout.InsertRange(firstIndex, shuffledGroup); } return Task.FromResult(true);