Add go_live_at timestamp to set_as_broadcast_service

Note, I haven't added anything for the `go_live_user` because it doesn't
quite make sense because here a user isn't requesting to go live. So
there should be no reason to record this.

We will in time though want to add audit events to capture every change
to the service broadcast settings, that will actually capture who has
done what.
This commit is contained in:
David McDonald
2021-02-12 17:22:09 +00:00
parent 42163813fe
commit f9c87bafa3
2 changed files with 39 additions and 0 deletions

View File

@@ -1116,6 +1116,14 @@ def set_as_broadcast_service(service_id):
service.count_as_live = False
if data["service_mode"] == "live":
if service.restricted == True:
# Only update the go live at timestamp if this if moving from training mode
# to live mode, not if it's moving from one type of live mode service to another
service.go_live_at = datetime.utcnow()
else:
service.go_live_at = None
service.restricted = True
if data["service_mode"] == "live":
service.restricted = False