Fixed percentage for special values (fixes #3736), added config to couple the candidates with the list of speakers (closes #3737)

This commit is contained in:
FinnStutzenstein 2018-05-09 08:47:05 +02:00 committed by Emanuel Schütze
parent 39da8f942f
commit c7a2f5c47c
4 changed files with 22 additions and 9 deletions

View File

@ -55,6 +55,15 @@ def get_config_variables():
group='Elections',
subgroup='Ballot and ballot papers')
yield ConfigVariable(
name='assignments_add_candidates_to_list_of_speakers',
default_value=True,
input_type='boolean',
label='Put all candidates on the list of speakers',
weight=428,
group='Elections',
subgroup='Ballot and ballot papers')
yield ConfigVariable(
name='assignments_pdf_ballot_papers_selection',
default_value='CUSTOM_NUMBER',

View File

@ -285,14 +285,15 @@ class Assignment(RESTModelMixin, models.Model):
# Add all candidates to list of speakers of related agenda item
# TODO: Try to do this in a bulk create
for candidate in self.candidates:
try:
Speaker.objects.add(candidate, self.agenda_item, skip_autoupdate=True)
except OpenSlidesError:
# The Speaker is already on the list. Do nothing.
# TODO: Find a smart way not to catch the error concerning AnonymousUser.
pass
inform_changed_data(self.agenda_item)
if config['assignments_add_candidates_to_list_of_speakers']:
for candidate in self.candidates:
try:
Speaker.objects.add(candidate, self.agenda_item, skip_autoupdate=True)
except OpenSlidesError:
# The Speaker is already on the list. Do nothing.
# TODO: Find a smart way not to catch the error concerning AnonymousUser.
pass
inform_changed_data(self.agenda_item)
return poll

View File

@ -72,7 +72,9 @@ angular.module('OpenSlidesApp.assignments', [])
if (base && !skipPercents) {
percentNumber = Math.round(vote.weight * 100 / base * 100) / 100;
percentStr = "(" + percentNumber + "%)";
if (percentNumber >= 0) {
percentStr = '(' + percentNumber + ' %)';
}
}
votes.push({
'order': order,

View File

@ -875,6 +875,7 @@ angular.module('OpenSlidesApp.assignments.site', [
gettext('Two-thirds majority');
gettext('Three-quarters majority');
gettext('Disabled');
gettext('Put all candidates on the list of speakers');
gettext('Title for PDF document (all elections)');
gettext('Preamble text for PDF document (all elections)');
//other translations