Changed begin speach behavior. Fix merge conflicts. Add tests.

This commit is contained in:
Norman Jäckel 2013-10-18 22:28:38 +02:00
parent 40af20cedb
commit 40faaa39c6
3 changed files with 27 additions and 9 deletions

View File

@ -11,7 +11,6 @@
"""
from datetime import datetime
from time import time
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes import generic
@ -22,10 +21,10 @@ from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy, ugettext_noop
from mptt.models import MPTTModel, TreeForeignKey
from openslides.projector.api import (get_active_slide, update_projector,
update_projector_overlay,
start_countdown,
stop_countdown)
from openslides.config.api import config
from openslides.projector.api import (get_active_slide, reset_countdown,
start_countdown, stop_countdown,
update_projector, update_projector_overlay)
from openslides.projector.models import SlideMixin
from openslides.utils.exceptions import OpenSlidesError
from openslides.utils.person.models import PersonField
@ -383,6 +382,7 @@ class Speaker(models.Model):
self.save()
# start countdown
if config['agenda_couple_countdown_and_speakers']:
reset_countdown()
start_countdown()
def end_speach(self):

View File

@ -10,8 +10,6 @@
:license: GNU GPL, see LICENSE for more details.
"""
from time import time
from django.contrib import messages
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
@ -26,8 +24,8 @@ from openslides.utils.views import (AjaxMixin, CreateView, DeleteView,
from .api import (get_active_slide, get_all_widgets, get_overlays,
get_projector_content, get_projector_overlays,
get_projector_overlays_js, set_active_slide, start_countdown, stop_countdown, reset_countdown,
update_projector_overlay)
get_projector_overlays_js, reset_countdown, set_active_slide,
start_countdown, stop_countdown, update_projector_overlay)
from .forms import SelectWidgetsForm
from .models import ProjectorSlide
from .projector import Widget

View File

@ -10,6 +10,7 @@
from django.test.client import Client
from openslides.agenda.models import Item, Speaker
from openslides.config.api import config
from openslides.participant.models import Group, User
from openslides.projector.api import set_active_slide
from openslides.utils.exceptions import OpenSlidesError
@ -74,6 +75,25 @@ class ListOfSpeakerModelTests(TestCase):
self.assertIsNotNone(Speaker.objects.get(person=self.speaker1, item=self.item1).end_time)
self.assertIsNotNone(speaker2_item1.begin_time)
def test_speach_coupled_with_countdown(self):
config['agenda_couple_countdown_and_speakers'] = True
self.assertTrue(config['countdown_state'] == 'inactive')
speaker1_item1 = Speaker.objects.add(self.speaker1, self.item1)
speaker1_item1.begin_speach()
self.assertTrue(config['countdown_state'] == 'active')
speaker1_item1.end_speach()
self.assertTrue(config['countdown_state'] == 'paused')
def test_begin_speach_not_coupled_with_countdown(self):
config['agenda_couple_countdown_and_speakers'] = False
self.assertTrue(config['countdown_state'] == 'inactive')
speaker1_item1 = Speaker.objects.add(self.speaker1, self.item1)
speaker1_item1.begin_speach()
self.assertTrue(config['countdown_state'] == 'inactive')
config['countdown_state'] = 'active'
speaker1_item1.end_speach()
self.assertTrue(config['countdown_state'] == 'active')
class SpeakerViewTestCase(TestCase):
def setUp(self):