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, onehundred_percent_base: this.defaultPercentBase,
majority_method: this.defaultMajorityMethod, majority_method: this.defaultMajorityMethod,
groups_id: this.defaultGroupIds, 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 django.core.validators import MinValueValidator
from openslides.assignments.models import AssignmentPoll from openslides.assignments.models import AssignmentPoll
@ -25,14 +26,24 @@ def get_config_variables():
subgroup="Ballot", 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( yield ConfigVariable(
name="assignment_poll_default_type", name="assignment_poll_default_type",
default_value=AssignmentPoll.TYPE_ANALOG, default_value=AssignmentPoll.TYPE_ANALOG,
input_type="choice", input_type="choice",
label="Default voting type", label="Default voting type",
choices=tuple( choices=assignment_poll_type_choices,
{"value": type[0], "display_name": type[1]} for type in AssignmentPoll.TYPES
),
weight=403, weight=403,
group="Elections", group="Elections",
subgroup="Ballot", subgroup="Ballot",

View File

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