From c73271c617e865887ca2c6ca327e37cd72b71829 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Thu, 2 Oct 2025 13:23:24 -0500 Subject: [PATCH] Bug Fix: Sort order while bulk creating channels will now be in the order they were selected in not reverse order. --- apps/channels/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/channels/tasks.py b/apps/channels/tasks.py index 041ff58f..732d03cc 100755 --- a/apps/channels/tasks.py +++ b/apps/channels/tasks.py @@ -2256,7 +2256,9 @@ def bulk_create_channels_from_streams(self, stream_ids, channel_profile_ids=None for i in range(0, total_streams, batch_size): batch_stream_ids = stream_ids[i:i + batch_size] - batch_streams = Stream.objects.filter(id__in=batch_stream_ids) + # Fetch streams and preserve the order from batch_stream_ids + batch_streams_dict = {stream.id: stream for stream in Stream.objects.filter(id__in=batch_stream_ids)} + batch_streams = [batch_streams_dict[stream_id] for stream_id in batch_stream_ids if stream_id in batch_streams_dict] # Send progress update send_websocket_update('updates', 'update', {