liquid_feedback_frontend

diff 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
line diff
     1.1 --- a/app/main/suggestion/_action/add.lua	Thu Dec 10 12:00:00 2009 +0100
     1.2 +++ b/app/main/suggestion/_action/add.lua	Fri Dec 25 12:00:00 2009 +0100
     1.3 @@ -1,4 +1,8 @@
     1.4 -db:query("BEGIN")
     1.5 +local tmp = db:query({ "SELECT text_entries_left FROM member_contingent_left WHERE member_id = ?", app.session.member.id }, "opt_object")
     1.6 +if tmp and tmp.text_entries_left and tmp.text_entries_left < 1 then
     1.7 +  slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...")
     1.8 +  return false
     1.9 +end
    1.10  
    1.11  local suggestion = Suggestion:new()
    1.12  
    1.13 @@ -6,6 +10,17 @@
    1.14  param.update(suggestion, "name", "description", "initiative_id")
    1.15  suggestion:save()
    1.16  
    1.17 +-- TODO important m1 selectors returning result _SET_!
    1.18 +local issue = suggestion.initiative:get_reference_selector("issue"):for_share():single_object_mode():exec()
    1.19 +
    1.20 +if issue.closed then
    1.21 +  slot.put_into("error", _"This issue is already closed.")
    1.22 +  return false
    1.23 +elseif issue.fully_frozen then 
    1.24 +  slot.put_into("error", _"Voting for this issue has already begun.")
    1.25 +  return false
    1.26 +end
    1.27 +
    1.28  local opinion = Opinion:new()
    1.29  
    1.30  opinion.suggestion_id = suggestion.id
    1.31 @@ -15,6 +30,4 @@
    1.32  
    1.33  opinion:save()
    1.34  
    1.35 -db:query("COMMIT")
    1.36 -
    1.37  slot.put_into("notice", _"Your suggestion has been added")
    1.38 \ No newline at end of file

Impressum / About Us