mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Fixes stream ordering.
This commit is contained in:
parent
336ccac0d5
commit
c5748346eb
1 changed files with 13 additions and 1 deletions
|
|
@ -209,7 +209,19 @@ class ChannelSerializer(serializers.ModelSerializer):
|
|||
|
||||
# Handle streams if provided
|
||||
if stream_ids is not None:
|
||||
instance.streams.set(stream_ids)
|
||||
# Clear existing associations
|
||||
instance.channelstream_set.all().delete()
|
||||
|
||||
# Create new associations with proper ordering
|
||||
for index, stream in enumerate(stream_ids):
|
||||
# Extract the ID from the Stream object
|
||||
actual_stream_id = stream.id if hasattr(stream, "id") else stream
|
||||
print(f'Setting stream {actual_stream_id} to index {index}')
|
||||
ChannelStream.objects.create(
|
||||
channel=instance,
|
||||
stream_id=actual_stream_id,
|
||||
order=index
|
||||
)
|
||||
|
||||
return instance
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue