diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index b7ae02247..1c24f48d6 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -47,6 +47,41 @@ def view(request, item_id): }, context_instance=RequestContext(request)) +def assignment_votes(item): + votes = [] + if item.type == "ItemAssignment": + assignment = item.cast().assignment + publish_winner_results_only = config_get("assignment_publish_winner_results_only") + # list of votes + votes = [] + for candidate in assignment.candidates: + tmplist = [[candidate, assignment.is_elected(candidate)], []] + for poll in assignment.poll_set.all(): + if poll.published: + if candidate in poll.options_values: + # check config option 'publish_winner_results_only' + if not publish_winner_results_only \ + or publish_winner_results_only and assignment.is_elected(candidate): + option = Option.objects.filter(poll=poll).filter(user=candidate)[0] + if poll.optiondecision: + tmplist[1].append([option.yes, option.no, option.undesided]) + else: + tmplist[1].append(option.yes) + else: + tmplist[1].append("") + else: + tmplist[1].append("-") + votes.append(tmplist) + return votes + + +def assignment_polls(item): + polls = [] + if item.type == "ItemAssignment": + for poll in item.cast().assignment.poll_set.filter(assignment=item.cast().assignment): + polls.append(poll) + return polls + @permission_required('agenda.can_see_agenda') @template('agenda/overview.html') diff --git a/openslides/beamer/api.py b/openslides/beamer/api.py deleted file mode 100644 index 39f57d320..000000000 --- a/openslides/beamer/api.py +++ /dev/null @@ -1,34 +0,0 @@ -def assignment_votes(item): - votes = [] - if item.type == "ItemAssignment": - assignment = item.cast().assignment - publish_winner_results_only = config_get("assignment_publish_winner_results_only") - # list of votes - votes = [] - for candidate in assignment.candidates: - tmplist = [[candidate, assignment.is_elected(candidate)], []] - for poll in assignment.poll_set.all(): - if poll.published: - if candidate in poll.options_values: - # check config option 'publish_winner_results_only' - if not publish_winner_results_only \ - or publish_winner_results_only and assignment.is_elected(candidate): - option = Option.objects.filter(poll=poll).filter(user=candidate)[0] - if poll.optiondecision: - tmplist[1].append([option.yes, option.no, option.undesided]) - else: - tmplist[1].append(option.yes) - else: - tmplist[1].append("") - else: - tmplist[1].append("-") - votes.append(tmplist) - return votes - - -def assignment_polls(item): - polls = [] - if item.type == "ItemAssignment": - for poll in item.cast().assignment.poll_set.filter(assignment=item.cast().assignment): - polls.append(poll) - return polls diff --git a/openslides/beamer/views.py b/openslides/beamer/views.py index c1dfa9c73..f9e1959d2 100644 --- a/openslides/beamer/views.py +++ b/openslides/beamer/views.py @@ -28,13 +28,11 @@ from agenda.api import get_active_item, is_summary, children_list, \ del_confirm_form_for_items from agenda.models import Item -from beamer.api import assignment_votes, assignment_polls - @permission_required('agenda.can_see_projector') def beamer(request): """ - Shows the active Slide. + Shows a active Slide. """ data = {'ajax': 'on'} template = ''