Skip to content

Commit

Permalink
Move proposition states to scheduled when added to voting phase
Browse files Browse the repository at this point in the history
  • Loading branch information
kaenganxt committed Jul 15, 2023
1 parent 36507ce commit a21f4c3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ekklesia_portal/concepts/ballot/ballot_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ekklesia_portal.app import App
from ekklesia_portal.datamodel import Ballot, SubjectArea, VotingPhase
from ekklesia_portal.enums import PropositionStatus, VotingStatus
from ekklesia_portal.lib.identity import identity_manages_department, identity_manages_any_department
from ekklesia_portal.permission import EditPermission

Expand Down Expand Up @@ -106,5 +107,11 @@ def update(self, request, appstruct):
if not department_allowed:
return HTTPBadRequest("department not allowed")

# Move proposition states to scheduled when adding ballot to voting phase
if voting_phase and voting_phase.status == VotingStatus.PREPARING:
for proposition in self.propositions:
if proposition.status == PropositionStatus.QUALIFIED:
proposition.status = PropositionStatus.SCHEDULED

self.update(**appstruct)
return redirect(request.link(self))

0 comments on commit a21f4c3

Please sign in to comment.