fix(playout): missing live show events (#2087)

This commit is contained in:
Jonas L 2022-09-06 14:09:04 +02:00 committed by GitHub
parent be14fb8096
commit ef1de34111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 132 additions and 4 deletions

View file

@ -26,11 +26,13 @@ class Show(models.Model):
)
live_auth_registered = models.BooleanField(
default=False,
blank=True,
null=True,
db_column="live_stream_using_airtime_auth",
)
live_auth_custom = models.BooleanField(
default=False,
blank=True,
null=True,
db_column="live_stream_using_custom_auth",
@ -48,6 +50,10 @@ class Show(models.Model):
db_column="live_stream_pass",
)
@property
def live_enabled(self) -> bool:
return any((self.live_auth_registered, self.live_auth_custom))
# A show is linkable if it has never been linked before. Once
# a show becomes unlinked it can not be linked again.
linked = models.BooleanField()

View file

@ -15,6 +15,7 @@ class ShowSerializer(serializers.ModelSerializer):
"image",
"foreground_color",
"background_color",
"live_enabled",
"linked",
"linkable",
"auto_playlist",

View file

@ -0,0 +1,15 @@
from ...models import Show
def test_show_live_enabled():
show = Show(
name="My Test Show",
description="My test show description",
)
assert not show.live_enabled
show.live_auth_registered = True
assert show.live_enabled
show.live_auth_custom = True
assert show.live_enabled