liquid_feedback_frontend
changeset 964:1997cf1da04b
Added support for finished phases
author | bsw |
---|---|
date | Thu Feb 21 19:32:48 2013 +0100 (2013-02-21) |
parents | 03b0ac783fe0 |
children | 65c95cb65b4e |
files | app/main/draft/_action/add.lua app/main/initiative/_action/add_support.lua app/main/initiative/_action/remove_support.lua app/main/initiative/_action/revoke.lua app/main/interest/_action/update.lua app/main/opinion/_action/update.lua app/main/suggestion/_action/add.lua app/main/vote/_action/non_voter.lua app/main/vote/_action/update.lua |
line diff
1.1 --- a/app/main/draft/_action/add.lua Thu Feb 21 18:56:59 2013 +0100 1.2 +++ b/app/main/draft/_action/add.lua Thu Feb 21 19:32:48 2013 +0100 1.3 @@ -9,6 +9,9 @@ 1.4 elseif issue.half_frozen then 1.5 slot.put_into("error", _"This issue is already frozen.") 1.6 return false 1.7 +elseif issue.phase_finished then 1.8 + slot.put_into("error", _"Current phase is already closed.") 1.9 + return false 1.10 end 1.11 1.12 local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
2.1 --- a/app/main/initiative/_action/add_support.lua Thu Feb 21 18:56:59 2013 +0100 2.2 +++ b/app/main/initiative/_action/add_support.lua Thu Feb 21 19:32:48 2013 +0100 2.3 @@ -11,9 +11,15 @@ 2.4 if issue.closed then 2.5 slot.put_into("error", _"This issue is already closed.") 2.6 return false 2.7 -elseif issue.fully_frozen then 2.8 +elseif issue.fully_frozen then 2.9 slot.put_into("error", _"Voting for this issue has already begun.") 2.10 return false 2.11 +elseif 2.12 + (issue.half_frozen and issue.phase_finished) or 2.13 + (not issue.accepted and issue.phase_finished) 2.14 +then 2.15 + slot.put_into("error", _"Current phase is already closed.") 2.16 + return false 2.17 end 2.18 2.19 if initiative.revoked then
3.1 --- a/app/main/initiative/_action/remove_support.lua Thu Feb 21 18:56:59 2013 +0100 3.2 +++ b/app/main/initiative/_action/remove_support.lua Thu Feb 21 19:32:48 2013 +0100 3.3 @@ -9,6 +9,12 @@ 3.4 elseif issue.fully_frozen then 3.5 slot.put_into("error", _"Voting for this issue has already begun.") 3.6 return false 3.7 +elseif 3.8 + (issue.half_frozen and issue.phase_finished) or 3.9 + (not issue.accepted and issue.phase_finished) 3.10 +then 3.11 + slot.put_into("error", _"Current phase is already closed.") 3.12 + return false 3.13 end 3.14 3.15 local member = app.session.member
4.1 --- a/app/main/initiative/_action/revoke.lua Thu Feb 21 18:56:59 2013 +0100 4.2 +++ b/app/main/initiative/_action/revoke.lua Thu Feb 21 19:32:48 2013 +0100 4.3 @@ -14,6 +14,9 @@ 4.4 elseif issue.half_frozen then 4.5 slot.put_into("error", _"This issue is already frozen.") 4.6 return false 4.7 +elseif not issue.accepted and issue.phase_finished then 4.8 + slot.put_into("error", _"Current phase is already closed.") 4.9 + return false 4.10 end 4.11 4.12 if initiative.revoked then
5.1 --- a/app/main/interest/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 5.2 +++ b/app/main/interest/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 5.3 @@ -10,6 +10,14 @@ 5.4 elseif issue.fully_frozen then 5.5 slot.put_into("error", _"Voting for this issue has already begun.") 5.6 return false 5.7 +elseif 5.8 + (issue.half_frozen and issue.phase_finished) or 5.9 + (not issue.accepted and issue.phase_finished) 5.10 +then 5.11 + slot.put_into("error", _"Current phase is already closed.") 5.12 + return false 5.13 +end 5.14 + 5.15 end 5.16 5.17 if param.get("delete", atom.boolean) then
6.1 --- a/app/main/opinion/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 6.2 +++ b/app/main/opinion/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 6.3 @@ -20,6 +20,12 @@ 6.4 elseif issue.fully_frozen then 6.5 slot.put_into("error", _"Voting for this issue has already begun.") 6.6 return false 6.7 +elseif 6.8 + (issue.half_frozen and issue.phase_finished) or 6.9 + (not issue.accepted and issue.phase_finished) 6.10 +then 6.11 + slot.put_into("error", _"Current phase is already closed.") 6.12 + return false 6.13 end 6.14 6.15 if param.get("delete") then
7.1 --- a/app/main/suggestion/_action/add.lua Thu Feb 21 18:56:59 2013 +0100 7.2 +++ b/app/main/suggestion/_action/add.lua Thu Feb 21 19:32:48 2013 +0100 7.3 @@ -51,6 +51,12 @@ 7.4 elseif issue.half_frozen then 7.5 slot.put_into("error", _"This issue is already frozen.") 7.6 return false 7.7 +elseif 7.8 + (issue.half_frozen and issue.phase_finished) or 7.9 + (not issue.accepted and issue.phase_finished) 7.10 +then 7.11 + slot.put_into("error", _"Current phase is already closed.") 7.12 + return false 7.13 end 7.14 7.15 local opinion = Opinion:new()
8.1 --- a/app/main/vote/_action/non_voter.lua Thu Feb 21 18:56:59 2013 +0100 8.2 +++ b/app/main/vote/_action/non_voter.lua Thu Feb 21 19:32:48 2013 +0100 8.3 @@ -1,12 +1,12 @@ 8.4 local issue = Issue:new_selector():add_where{ "id = ?", param.get("issue_id", atom.integer) }:for_share():single_object_mode():exec() 8.5 8.6 -if issue.closed then 8.7 - slot.put_into("error", _"This issue is already closed.") 8.8 +if issue.state ~= "voting" and not issue.closed then 8.9 + slot.put_into("error", _"Voting has not started yet.") 8.10 return false 8.11 end 8.12 8.13 -if issue.state ~= "voting" then 8.14 - slot.put_into("error", _"Voting has not started yet.") 8.15 +if issue.phase_finished or issue.closed then 8.16 + slot.put_into("error", _"This issue is already closed.") 8.17 return false 8.18 end 8.19
9.1 --- a/app/main/vote/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 9.2 +++ b/app/main/vote/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 9.3 @@ -11,13 +11,13 @@ 9.4 9.5 local update_comment = param.get("update_comment") == "1" and true or false 9.6 9.7 -if issue.closed and not update_comment then 9.8 - slot.put_into("error", _"This issue is already closed.") 9.9 +if issue.state ~= "voting" and not issue.closed then 9.10 + slot.put_into("error", _"Voting has not started yet.") 9.11 return false 9.12 end 9.13 9.14 -if issue.state ~= "voting" and not issue.closed then 9.15 - slot.put_into("error", _"Voting has not started yet.") 9.16 +if issue.phase_finished or issue.closed and not update_comment then 9.17 + slot.put_into("error", _"This issue is already closed.") 9.18 return false 9.19 end 9.20