Merge pull request #5720 from FinnStutzenstein/fixSelectableNonAnalogPollsIfDisabled

Remove the possibility to select default non-analog poll types, if el…
This commit is contained in:
Emanuel Schütze 2020-11-24 11:37:16 +01:00 committed by GitHub
commit 36506a7383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 7 deletions

View File

@ -232,7 +232,7 @@ export abstract class PollService {
onehundred_percent_base: this.defaultPercentBase,
majority_method: this.defaultMajorityMethod,
groups_id: this.defaultGroupIds,
type: this.defaultPollType
type: this.isElectronicVotingEnabled ? this.defaultPollType : PollType.Analog
};
}

View File

@ -1,3 +1,4 @@
from django.conf import settings
from django.core.validators import MinValueValidator
from openslides.assignments.models import AssignmentPoll
@ -25,14 +26,24 @@ def get_config_variables():
subgroup="Ballot",
)
if getattr(settings, "ENABLE_ELECTRONIC_VOTING", False):
assignment_poll_type_choices = tuple(
{"value": type[0], "display_name": type[1]} for type in AssignmentPoll.TYPES
)
else:
assignment_poll_type_choices = (
{
"value": AssignmentPoll.TYPE_ANALOG,
"display_name": AssignmentPoll.TYPE_ANALOG,
},
)
yield ConfigVariable(
name="assignment_poll_default_type",
default_value=AssignmentPoll.TYPE_ANALOG,
input_type="choice",
label="Default voting type",
choices=tuple(
{"value": type[0], "display_name": type[1]} for type in AssignmentPoll.TYPES
),
choices=assignment_poll_type_choices,
weight=403,
group="Elections",
subgroup="Ballot",

View File

@ -1,3 +1,4 @@
from django.conf import settings
from django.core.validators import MinValueValidator
from openslides.core.config import ConfigVariable
@ -341,14 +342,21 @@ def get_config_variables():
# Voting and ballot papers
if getattr(settings, "ENABLE_ELECTRONIC_VOTING", False):
motion_poll_type_choices = tuple(
{"value": type[0], "display_name": type[1]} for type in MotionPoll.TYPES
)
else:
motion_poll_type_choices = (
{"value": MotionPoll.TYPE_ANALOG, "display_name": MotionPoll.TYPE_ANALOG},
)
yield ConfigVariable(
name="motion_poll_default_type",
default_value=MotionPoll.TYPE_ANALOG,
input_type="choice",
label="Default voting type",
choices=tuple(
{"value": type[0], "display_name": type[1]} for type in MotionPoll.TYPES
),
choices=motion_poll_type_choices,
weight=367,
group="Motions",
subgroup="Voting and ballot papers",