diff --git a/alembic/versions/ec225b9c33e3_voting_days_for_votingphase_and_votingphasetype.py b/alembic/versions/ec225b9c33e3_voting_days_for_votingphase_and_votingphasetype.py
new file mode 100644
index 00000000..8f986d25
--- /dev/null
+++ b/alembic/versions/ec225b9c33e3_voting_days_for_votingphase_and_votingphasetype.py
@@ -0,0 +1,35 @@
+"""voting_days for VotingPhase and VotingPhaseType
+
+Revision ID: ec225b9c33e3
+Revises: 50a310f352b0
+Create Date: 2021-07-10 16:11:51.416233
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+# revision identifiers, used by Alembic.
+revision = 'ec225b9c33e3'
+down_revision = '50a310f352b0'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column(
+ 'voting_phase_types',
+ sa.Column('voting_days', sa.Integer(), nullable=True, comment='voting duration in days; ends at target date')
+ )
+ op.add_column(
+ 'votingphases',
+ sa.Column('voting_days', sa.Integer(), nullable=True, comment='voting duration in days; ends at target date')
+ )
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('votingphases', 'voting_days')
+ op.drop_column('voting_phase_types', 'voting_days')
+ # ### end Alembic commands ###
diff --git a/src/ekklesia_portal/concepts/voting_phase/voting_phase_cells.py b/src/ekklesia_portal/concepts/voting_phase/voting_phase_cells.py
index fbfc2fe9..207d4054 100644
--- a/src/ekklesia_portal/concepts/voting_phase/voting_phase_cells.py
+++ b/src/ekklesia_portal/concepts/voting_phase/voting_phase_cells.py
@@ -24,7 +24,17 @@ def show_new_button(self):
@App.cell(VotingPhase)
class VotingPhaseCell(LayoutCell):
model_properties = [
- 'ballots', 'department', 'description', 'name', 'phase_type', 'secret', 'status', 'target', 'title'
+ 'ballots',
+ 'department',
+ 'description',
+ 'name',
+ 'phase_type',
+ 'secret',
+ 'status',
+ 'target',
+ 'title',
+ 'voting_end',
+ 'voting_start',
]
def show_edit_button(self):
@@ -43,15 +53,6 @@ def show_voting(self):
def propositions(self):
return [p for b in self._model.ballots for p in b.propositions]
- def voting_start(self):
- if self._model.target is None:
- return
- # XXX: Fixed time interval for voting! We need a proper setting here.
- return self._model.target - datetime.timedelta(days=14)
-
- def voting_end(self):
- return self._model.target
-
def votings(self):
votings = []
for name, settings in self._model.department.voting_module_settings.items():
diff --git a/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py b/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py
index 0e0291bf..8dcbf29b 100644
--- a/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py
+++ b/src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py
@@ -15,6 +15,7 @@ class VotingPhaseSchema(Schema):
department_id = int_property(title=_('department'))
phase_type_id = int_property(title=_('voting_phase_type'))
secret = bool_property(title=_('secret_voting_possible'))
+ voting_days = int_property(title=_('voting_days'), missing=None)
description = string_property(title=_('description'), validator=Length(min=10, max=65536), missing='')
voting_module_data = json_property(title=_('voting_module_data'), missing={})
diff --git a/src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade b/src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade
index 0a566ee7..e2ea36f4 100644
--- a/src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade
+++ b/src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade
@@ -29,6 +29,9 @@
dd= abbreviation
dt= _('voting_type')
dd= voting_type|enum_value
+ if voting_days
+ dt= _('voting_days')
+ dd= voting_days
dt= _('secret_voting_possible')
dd= secret_voting_possible|yesno
diff --git a/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_cells.py b/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_cells.py
index 8873714c..03b7aaab 100644
--- a/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_cells.py
+++ b/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_cells.py
@@ -27,6 +27,7 @@ class VotingPhaseTypeCell(LayoutCell):
'name',
'secret_voting_possible',
'voting_type',
+ 'voting_days',
]
def show_edit_button(self):
diff --git a/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py b/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py
index eb23721b..acbbfe42 100644
--- a/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py
+++ b/src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py
@@ -1,7 +1,7 @@
from colander import Length
from deform import Button
from deform.widget import Select2Widget, TextAreaWidget
-from ekklesia_common.contract import Schema, Form, bool_property, string_property, enum_property
+from ekklesia_common.contract import Schema, Form, bool_property, int_property, string_property, enum_property
from ekklesia_common.translation import _
from ekklesia_portal.enums import VotingType
@@ -12,6 +12,7 @@ class VotingPhaseTypeSchema(Schema):
abbreviation = string_property(title=_('abbreviation'), validator=Length(max=6))
secret_voting_possible = bool_property(title=_('secret_voting_possible'))
voting_type = enum_property(VotingType, title=_('voting_type'))
+ voting_days = int_property(title=_('voting_days'), missing=None)
description = string_property(title=_('description'), validator=Length(min=10, max=2000), missing='')
diff --git a/src/ekklesia_portal/datamodel.py b/src/ekklesia_portal/datamodel.py
index 33267376..9ac64514 100644
--- a/src/ekklesia_portal/datamodel.py
+++ b/src/ekklesia_portal/datamodel.py
@@ -18,7 +18,7 @@
# along with this program. If not, see .
# For more details see the file COPYING.
-from datetime import datetime
+from datetime import datetime, timedelta
import math
from ekklesia_common.database import Base, C, LIDType, integer_pk
@@ -49,7 +49,9 @@ class Group(Base):
id: int = C(Integer, Sequence('id_seq', optional=True), primary_key=True)
name: str = C(Text, unique=True, nullable=False)
is_admin_group: bool = C(Boolean, nullable=False, server_default='false')
- members = association_proxy('group_members', 'member', creator=lambda u: GroupMember(member=u)) # <-GroupMember-> User
+ members = association_proxy(
+ 'group_members', 'member', creator=lambda u: GroupMember(member=u)
+ ) # <-GroupMember-> User
class User(Base):
@@ -73,7 +75,9 @@ class User(Base):
)
# actions: submit/support proposition, voting, or explicit, deactivate after 2 periods
profile = relationship("UserProfile", uselist=False, back_populates="user")
- groups = association_proxy('member_groups', 'group', creator=lambda g: GroupMember(group=g)) # <-GroupMember-> Group
+ groups = association_proxy(
+ 'member_groups', 'group', creator=lambda g: GroupMember(group=g)
+ ) # <-GroupMember-> Group
# from user/membership/ all_nested_groups
departments = association_proxy('member_departments', 'department') # <-DepartmentMember-> Department
areas = association_proxy('member_areas', 'area') # <-AreaMember-> SubjectArea
@@ -318,19 +322,19 @@ class VotingPhaseType(Base):
abbreviation: str = C(Text, server_default='', comment='abbreviated name')
secret_voting_possible: bool = C(Boolean, nullable=False)
voting_type = C(Enum(VotingType), nullable=False) # online, urn, assembly, board
+ voting_days: int = C(Integer, comment='voting duration in days; ends at target date')
description: str = C(Text, server_default='')
class VotingPhase(Base): # Abstimmungsperiode
__tablename__ = 'votingphases'
__table_args__ = (
- CheckConstraint(
- "status='PREPARING' OR (status!='PREPARING' AND target IS NOT NULL)", 'state_valid'
- ),
+ CheckConstraint("status='PREPARING' OR (status!='PREPARING' AND target IS NOT NULL)", 'state_valid'),
)
id: int = C(Integer, Sequence('id_seq', optional=True), primary_key=True)
status: VotingStatus = C(Enum(VotingStatus), nullable=False, server_default='PREPARING')
target: datetime = C(DateTime, comment='constrained by §4.1')
+ voting_days: int = C(Integer, comment='voting duration in days; ends at target date')
department_id: int = C(Integer, ForeignKey('departments.id'), nullable=False)
phase_type_id: int = C(Integer, ForeignKey('voting_phase_types.id'), nullable=False)
secret: bool = C(
@@ -361,7 +365,23 @@ def ballots_can_be_added(self):
@property
def voting_can_be_created(self):
- return self.status == VotingStatus.PREPARING and self.target is not None
+ return self.status == VotingStatus.PREPARING and self.voting_start is not None and self.voting_end is not None
+
+ @property
+ def voting_start(self):
+ if self.target is None:
+ return
+
+ days = self.voting_days or self.phase_type.voting_days
+
+ if days is None:
+ return
+
+ return self.target - timedelta(days=days)
+
+ @property
+ def voting_end(self):
+ return self.target
class Supporter(Base): # §3.5
diff --git a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po
index d075c56f..7b70c916 100644
--- a/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po
+++ b/src/ekklesia_portal/translations/de/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2021-07-06 23:07+0000\n"
+"POT-Creation-Date: 2021-07-10 22:49+0000\n"
"PO-Revision-Date: 2015-09-06 22:42+0200\n"
"Last-Translator: FULL NAME \n"
"Language: de\n"
@@ -50,8 +50,8 @@ msgstr "Ausführlich"
#: src/ekklesia_portal/concepts/proposition_type/proposition_type_contracts.py:18
#: src/ekklesia_portal/concepts/subject_area/subject_area_contracts.py:17
#: src/ekklesia_portal/concepts/user/user_contracts.py:18
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:25
-#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:21
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:26
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:22
msgid "submit"
msgstr "Senden"
@@ -301,9 +301,9 @@ msgstr "Neue Textanpassung"
#: src/ekklesia_portal/concepts/proposition_type/templates/proposition_type.j2.jade:12
#: src/ekklesia_portal/concepts/subject_area/subject_area_contracts.py:11
#: src/ekklesia_portal/concepts/subject_area/templates/subject_area.j2.jade:12
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:18
-#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:19
-#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:15
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:19
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:21
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:16
msgid "description"
msgstr "Beschreibung"
@@ -571,7 +571,7 @@ msgstr "Minimale Anzahl an Unterstützern"
#: src/ekklesia_portal/concepts/policy/policy_contracts.py:16
#: src/ekklesia_portal/concepts/policy/templates/policy.j2.jade:16
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15
msgid "qualification_quorum"
msgstr "Unterstützer-Quorum zur Zulassung zur Abstimmung"
@@ -787,24 +787,24 @@ msgstr "Begründung"
msgid "changes"
msgstr "Änderungen"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:5
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:5
msgid "button_retract_secret_voting"
msgstr "Forderung auf Papierabstimmung zurückziehen"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:8
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:8
msgid "button_request_secret_voting"
msgstr "Papierabstimmung fordern"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13
msgid "abbr_secret_voters_count"
msgstr "Anzahl Befürworter für Papierabstimmung"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13
msgid "abbr_secret_voting_quorum"
msgstr "Quorum für Papierabstimmung"
#: src/ekklesia_portal/concepts/proposition/templates/proposition_small.j2.jade:10
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15
#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:2
#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_submitted.j2.jade:2
msgid "supporter"
@@ -836,14 +836,19 @@ msgstr ""
msgid "title_notice"
msgstr "Hinweis"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:5
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:5
msgid "button_retract_support"
msgstr "Unterstützung zurückziehen"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:8
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:8
msgid "button_support"
msgstr "Unterstützen"
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:10
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:19
+msgid "supporters"
+msgstr "Unterstützer"
+
#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:6
msgid "btn_sort_by_identifier_or_title"
msgstr "Nach Kennung/Titel sortieren"
@@ -1238,12 +1243,18 @@ msgid "voting_phase_type"
msgstr "Art des Abstimmungszeitraums"
#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:17
-#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:15
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:17
#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:13
msgid "secret_voting_possible"
msgstr "Geheime Abstimmung möglich?"
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:19
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:18
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:15
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:15
+msgid "voting_days"
+msgstr "Dauer der Abstimmung in Tagen"
+
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:20
msgid "voting_module_data"
msgstr "Daten für externe Abstimmungssysteme"
diff --git a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po
index 1991f620..88745995 100644
--- a/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po
+++ b/src/ekklesia_portal/translations/en/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2021-07-06 23:07+0000\n"
+"POT-Creation-Date: 2021-07-10 22:49+0000\n"
"PO-Revision-Date: 2015-09-06 22:42+0200\n"
"Last-Translator: FULL NAME \n"
"Language: en\n"
@@ -50,8 +50,8 @@ msgstr "Details"
#: src/ekklesia_portal/concepts/proposition_type/proposition_type_contracts.py:18
#: src/ekklesia_portal/concepts/subject_area/subject_area_contracts.py:17
#: src/ekklesia_portal/concepts/user/user_contracts.py:18
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:25
-#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:21
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:26
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:22
msgid "submit"
msgstr "Submit"
@@ -301,9 +301,9 @@ msgstr "New Text Customization"
#: src/ekklesia_portal/concepts/proposition_type/templates/proposition_type.j2.jade:12
#: src/ekklesia_portal/concepts/subject_area/subject_area_contracts.py:11
#: src/ekklesia_portal/concepts/subject_area/templates/subject_area.j2.jade:12
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:18
-#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:19
-#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:15
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:19
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:21
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:16
msgid "description"
msgstr "Description"
@@ -571,7 +571,7 @@ msgstr "Minimum number of supporters"
#: src/ekklesia_portal/concepts/policy/policy_contracts.py:16
#: src/ekklesia_portal/concepts/policy/templates/policy.j2.jade:16
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15
msgid "qualification_quorum"
msgstr "Supporter quorum for voting qualification"
@@ -786,24 +786,24 @@ msgstr "Motivation"
msgid "changes"
msgstr "Changes"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:5
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:5
msgid "button_retract_secret_voting"
msgstr "Retract Voting on Paper Request"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:8
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:8
msgid "button_request_secret_voting"
msgstr "Request Voting on Paper"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13
msgid "abbr_secret_voters_count"
msgstr "number of supporters for vote on paper"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_secret_voting.j2.jade:13
msgid "abbr_secret_voting_quorum"
msgstr "quorum for vote on paper"
#: src/ekklesia_portal/concepts/proposition/templates/proposition_small.j2.jade:10
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:13
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:15
#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_scheduled.j2.jade:2
#: src/ekklesia_portal/concepts/proposition/templates/status/proposition_status_submitted.j2.jade:2
msgid "supporter"
@@ -832,14 +832,19 @@ msgstr ""
msgid "title_notice"
msgstr "Note"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:5
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:5
msgid "button_retract_support"
msgstr "Retract support"
-#: src/ekklesia_portal/concepts/proposition/templates/proposition_support_action.j2.jade:8
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:8
msgid "button_support"
msgstr "Support"
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:10
+#: src/ekklesia_portal/concepts/proposition/templates/proposition_support.j2.jade:19
+msgid "supporters"
+msgstr "Supporter"
+
#: src/ekklesia_portal/concepts/proposition/templates/propositions.j2.jade:6
msgid "btn_sort_by_identifier_or_title"
msgstr "Sort by Identifier/Title"
@@ -1228,12 +1233,18 @@ msgid "voting_phase_type"
msgstr "Voting Phase Type"
#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:17
-#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:15
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:17
#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:13
msgid "secret_voting_possible"
msgstr "Secret voting possible?"
-#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:19
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:18
+#: src/ekklesia_portal/concepts/voting_phase_type/templates/voting_phase_type.j2.jade:15
+#: src/ekklesia_portal/concepts/voting_phase_type/voting_phase_type_contracts.py:15
+msgid "voting_days"
+msgstr "Voting time in days"
+
+#: src/ekklesia_portal/concepts/voting_phase/voting_phase_contracts.py:20
msgid "voting_module_data"
msgstr "External Voting Data"
diff --git a/tests/create_test_db.py b/tests/create_test_db.py
index 7d9e67a9..05e744f4 100644
--- a/tests/create_test_db.py
+++ b/tests/create_test_db.py
@@ -18,8 +18,11 @@
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser("Ekklesia Portal create_test_db.py")
-parser.add_argument("-c", "--config-file",
- help=f"Optional path to config file in YAML / JSON format. Uses default test configuration when not set.")
+parser.add_argument(
+ "-c",
+ "--config-file",
+ help=f"Optional path to config file in YAML / JSON format. Uses default test configuration when not set."
+)
parser.add_argument("--doit", action="store_true", default=False)
DOCUMENT_WP = '''# Wahlprogramm
@@ -75,7 +78,6 @@
Du kannst die Bearbeitung sperren lassen. Wende dich dazu an die Antragskommission.
'''
-
if __name__ == "__main__":
logg = logging.getLogger(__name__)
@@ -175,7 +177,11 @@
depadmin.areas.extend([subject_area_ppd_allg])
voting_phase_type_ur = VotingPhaseType(
- name='Online-Urabstimmung', voting_type=VotingType.ONLINE, abbreviation='UR', secret_voting_possible=False
+ name='Online-Urabstimmung',
+ voting_type=VotingType.ONLINE,
+ abbreviation='UR',
+ secret_voting_possible=False,
+ voting_days=14
)
voting_phase_type_bpt = VotingPhaseType(
name='Bundesparteitag', voting_type=VotingType.ASSEMBLY, abbreviation='BPT', secret_voting_possible=True
@@ -188,6 +194,7 @@
secret=True,
title='BPT 2020.1',
name='bpt201',
+ voting_days=2,
description='Der nächste Parteitag irgendwo'
)
@@ -258,7 +265,9 @@
t2 = Tag(name="Tag2")
t3 = Tag(name="Täääg3")
- b1 = Ballot(area=subject_area_pps_in, voting=voting_phase_ppd_bpt_scheduled, name="PP001/2/3/4", proposition_type=ptype_pol)
+ b1 = Ballot(
+ area=subject_area_pps_in, voting=voting_phase_ppd_bpt_scheduled, name="PP001/2/3/4", proposition_type=ptype_pol
+ )
s.add(b1)
q1 = Proposition(
title="Ein Titel",
diff --git a/tests/test_db.sql b/tests/test_db.sql
index 0525db4a..c432aad7 100644
--- a/tests/test_db.sql
+++ b/tests/test_db.sql
@@ -1511,7 +1511,8 @@ CREATE TABLE public.voting_phase_types (
abbreviation text DEFAULT ''::text,
secret_voting_possible boolean NOT NULL,
voting_type public.votingtype NOT NULL,
- description text DEFAULT ''::text
+ description text DEFAULT ''::text,
+ voting_days integer
);
@@ -1529,6 +1530,13 @@ COMMENT ON COLUMN public.voting_phase_types.name IS 'readable name';
COMMENT ON COLUMN public.voting_phase_types.abbreviation IS 'abbreviated name';
+--
+-- Name: COLUMN voting_phase_types.voting_days; Type: COMMENT; Schema: public; Owner: -
+--
+
+COMMENT ON COLUMN public.voting_phase_types.voting_days IS 'voting duration in days; ends at target date';
+
+
--
-- Name: voting_phase_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
@@ -1558,6 +1566,7 @@ CREATE TABLE public.votingphases (
title text DEFAULT ''::text,
description text DEFAULT ''::text,
voting_module_data jsonb DEFAULT '{}'::jsonb,
+ voting_days integer,
CONSTRAINT ck_votingphases_state_valid CHECK (((status = 'PREPARING'::public.votingstatus) OR ((status <> 'PREPARING'::public.votingstatus) AND (target IS NOT NULL))))
);
@@ -1583,6 +1592,13 @@ COMMENT ON COLUMN public.votingphases.secret IS 'whether any secret votes will t
COMMENT ON COLUMN public.votingphases.name IS 'short, readable name which can be used for URLs';
+--
+-- Name: COLUMN votingphases.voting_days; Type: COMMENT; Schema: public; Owner: -
+--
+
+COMMENT ON COLUMN public.votingphases.voting_days IS 'voting duration in days; ends at target date';
+
+
--
-- Name: votingphases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
@@ -1602,7 +1618,7 @@ ALTER TABLE public.votingphases ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDEN
--
COPY public.alembic_version (version_num) FROM stdin;
-50a310f352b0
+ec225b9c33e3
\.
@@ -1953,9 +1969,9 @@ COPY public.voting_module (id, name, description, base_url, module_type) FROM st
-- Data for Name: voting_phase_types; Type: TABLE DATA; Schema: public; Owner: -
--
-COPY public.voting_phase_types (id, name, abbreviation, secret_voting_possible, voting_type, description) FROM stdin;
-1 Bundesparteitag BPT t ASSEMBLY
-2 Online-Urabstimmung UR f ONLINE
+COPY public.voting_phase_types (id, name, abbreviation, secret_voting_possible, voting_type, description, voting_days) FROM stdin;
+1 Bundesparteitag BPT t ASSEMBLY \N
+2 Online-Urabstimmung UR f ONLINE 14
\.
@@ -1963,10 +1979,10 @@ COPY public.voting_phase_types (id, name, abbreviation, secret_voting_possible,
-- Data for Name: votingphases; Type: TABLE DATA; Schema: public; Owner: -
--
-COPY public.votingphases (id, status, target, department_id, phase_type_id, secret, name, title, description, voting_module_data) FROM stdin;
-2 PREPARING \N 5 2 f ur19+ Urabstimmung 2019+ eine **Urabstimmung** in Zentalschweiz {}
-3 FINISHED 2019-11-10 00:00:00 3 1 t bpt192 BPT 2019.2 Der BPT in Bad Homburg {}
-1 PREPARING 2020-11-11 00:00:00 3 1 t bpt201 BPT 2020.1 Der nächste Parteitag irgendwo {}
+COPY public.votingphases (id, status, target, department_id, phase_type_id, secret, name, title, description, voting_module_data, voting_days) FROM stdin;
+2 PREPARING \N 5 2 f ur19+ Urabstimmung 2019+ eine **Urabstimmung** in Zentalschweiz {} \N
+3 FINISHED 2019-11-10 00:00:00 3 1 t bpt192 BPT 2019.2 Der BPT in Bad Homburg {} \N
+1 PREPARING 2020-11-11 00:00:00 3 1 t bpt201 BPT 2020.1 Der nächste Parteitag irgendwo {} 2
\.