Hot fix for broadcast (will improved later).

This commit is contained in:
Emanuel Schuetze 2016-09-30 21:13:58 +02:00
parent 6f2a509ebf
commit 720c7e76a5
3 changed files with 28 additions and 24 deletions

View File

@ -163,30 +163,32 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
$scope.$watch(function () { $scope.$watch(function () {
return Config.lastModified('projector_broadcast'); return Config.lastModified('projector_broadcast');
}, function () { }, function () {
var bc = Config.get('projector_broadcast').value; var bc = Config.get('projector_broadcast');
if ($scope.broadcast != bc) { if (bc) {
$scope.broadcast = bc; if ($scope.broadcast != bc.value) {
if ($scope.broadcastDeregister) { $scope.broadcast = bc.value;
// revert to original $scope.projector if ($scope.broadcastDeregister) {
$scope.broadcastDeregister(); // revert to original $scope.projector
$scope.broadcastDeregister = null; $scope.broadcastDeregister();
setElements($scope.projector); $scope.broadcastDeregister = null;
$scope.blank = $scope.projector.blank; setElements($scope.projector);
} $scope.blank = $scope.projector.blank;
}
if ($scope.broadcast > 0) {
// get elements and blank from broadcast projector
$scope.broadcastDeregister = $scope.$watch(function () {
return Projector.lastModified($scope.broadcast);
}, function () {
if ($scope.broadcast > 0) {
// var broadcast_projector = Projector.get($scope.broadcast);
Projector.find($scope.broadcast).then(function (broadcast_projector) {
setElements(broadcast_projector);
$scope.blank = broadcast_projector.blank;
});
} }
}); }
if ($scope.broadcast > 0) {
// get elements and blank from broadcast projector
$scope.broadcastDeregister = $scope.$watch(function () {
return Projector.lastModified($scope.broadcast);
}, function () {
if ($scope.broadcast > 0) {
var broadcast_projector = Projector.get($scope.broadcast);
if (broadcast_projector) {
setElements(broadcast_projector);
$scope.blank = broadcast_projector.blank;
}
}
});
}
} }
}); });

View File

@ -143,6 +143,8 @@ def send_data(message):
projectors = Projector.objects.all() # Also the broadcasted projector should get his data projectors = Projector.objects.all() # Also the broadcasted projector should get his data
send_all = True send_all = True
broadcast_projector_data = get_projector_element_data(Projector.objects.get(pk=broadcast_id)) broadcast_projector_data = get_projector_element_data(Projector.objects.get(pk=broadcast_id))
broadcast_projector_data.append(CollectionElement.from_values(
collection_string=Projector.get_collection_string(), id=broadcast_id).as_autoupdate_for_projector())
else: else:
broadcast_projector_data = None broadcast_projector_data = None

View File

@ -54,7 +54,7 @@ class ProjectorAPI(TestCase):
'error': 'Projector element does not exist.'}}, 'error': 'Projector element does not exist.'}},
'scale': 0, 'scale': 0,
'scroll': 0, 'scroll': 0,
'name': 'Defaultprojector', 'name': 'Default projector',
'blank': False, 'blank': False,
'width': 1024, 'width': 1024,
'height': 768}) 'height': 768})