liquid_feedback_frontend

view app/main/interest/_action/update.lua @ 964:1997cf1da04b

Added support for finished phases
author bsw
date Thu Feb 21 19:32:48 2013 +0100 (2013-02-21)
parents b77e6a17ca77
children 072fa7a9e0fc
line source
1 local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given")
3 local interest = Interest:by_pk(issue_id, app.session.member.id)
5 local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec()
7 if issue.closed then
8 slot.put_into("error", _"This issue is already closed.")
9 return false
10 elseif issue.fully_frozen then
11 slot.put_into("error", _"Voting for this issue has already begun.")
12 return false
13 elseif
14 (issue.half_frozen and issue.phase_finished) or
15 (not issue.accepted and issue.phase_finished)
16 then
17 slot.put_into("error", _"Current phase is already closed.")
18 return false
19 end
21 end
23 if param.get("delete", atom.boolean) then
24 if interest then
25 interest:destroy()
26 --slot.put_into("notice", _"Interest removed")
27 else
28 --slot.put_into("notice", _"Interest not existent")
29 end
30 return
31 end
33 if not app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
34 error("access denied")
35 end
37 if not interest then
38 interest = Interest:new()
39 interest.issue_id = issue_id
40 interest.member_id = app.session.member_id
41 end
43 interest:save()
45 --slot.put_into("notice", _"Interest updated")

Impressum / About Us