liquid_feedback_frontend

annotate app/main/suggestion/_action/add.lua @ 5:afd9f769c7ae

Version beta1

Final voting with Schulze-Method is now possible

Many bug fixes and code cleanup

Registration with invite codes

More sort and filter options

Seperated display of "supporters" and "potential supporters"

Optical changes

Flood limit / initiative contigent is now checked by frontend

Neccessary changes to access core beta11
author bsw/jbe
date Fri Dec 25 12:00:00 2009 +0100 (2009-12-25)
parents 3bfb2fcf7ab9
children 8d91bccab0bf
rev   line source
bsw/jbe@5 1 local tmp = db:query({ "SELECT text_entries_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object")
bsw/jbe@5 2 if tmp and tmp.text_entries_left and tmp.text_entries_left < 1 then
bsw/jbe@5 3 slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...")
bsw/jbe@5 4 return false
bsw/jbe@5 5 end
bsw/jbe@0 6
bsw/jbe@0 7 local suggestion = Suggestion:new()
bsw/jbe@0 8
bsw/jbe@0 9 suggestion.author_id = app.session.member.id
bsw/jbe@0 10 param.update(suggestion, "name", "description", "initiative_id")
bsw/jbe@0 11 suggestion:save()
bsw/jbe@0 12
bsw/jbe@5 13 -- TODO important m1 selectors returning result _SET_!
bsw/jbe@5 14 local issue = suggestion.initiative:get_reference_selector("issue"):for_share():single_object_mode():exec()
bsw/jbe@5 15
bsw/jbe@5 16 if issue.closed then
bsw/jbe@5 17 slot.put_into("error", _"This issue is already closed.")
bsw/jbe@5 18 return false
bsw/jbe@5 19 elseif issue.fully_frozen then
bsw/jbe@5 20 slot.put_into("error", _"Voting for this issue has already begun.")
bsw/jbe@5 21 return false
bsw/jbe@5 22 end
bsw/jbe@5 23
bsw/jbe@0 24 local opinion = Opinion:new()
bsw/jbe@0 25
bsw/jbe@0 26 opinion.suggestion_id = suggestion.id
bsw/jbe@0 27 opinion.member_id = app.session.member.id
bsw/jbe@0 28 opinion.degree = param.get("degree", atom.integer)
bsw/jbe@0 29 opinion.fulfilled = false
bsw/jbe@0 30
bsw/jbe@0 31 opinion:save()
bsw/jbe@0 32
bsw/jbe@0 33 slot.put_into("notice", _"Your suggestion has been added")

Impressum / About Us