liquid_feedback_frontend

diff app/main/initiative/_action/create.lua @ 901:f3d6d08b0125

Added support for creating free timed issues in poll mode
author bsw
date Tue Aug 21 01:16:03 2012 +0200 (2012-08-21)
parents ae9ab3edff89
children a176129ce282
line diff
     1.1 --- a/app/main/initiative/_action/create.lua	Tue Aug 21 00:33:17 2012 +0200
     1.2 +++ b/app/main/initiative/_action/create.lua	Tue Aug 21 01:16:03 2012 +0200
     1.3 @@ -95,6 +95,36 @@
     1.4      issue.accepted = 'now'
     1.5      issue.state = 'discussion'
     1.6      initiative.polling = true
     1.7 +    
     1.8 +    if policy.free_timeable then
     1.9 +      local free_timing_string = util.trim(param.get("free_timing"))
    1.10 +      local available_timings
    1.11 +      if config.free_timing and config.free_timing.available_func then
    1.12 +        available_timings = config.free_timing.available_func(policy)
    1.13 +        if available_timings == false then
    1.14 +          error("error in free timing config")
    1.15 +        end
    1.16 +      end
    1.17 +      if available_timings then
    1.18 +        local timing_available = false
    1.19 +        for i, available_timing in ipairs(available_timings) do
    1.20 +          if available_timing.id == free_timing_string then
    1.21 +            timing_available = true
    1.22 +          end
    1.23 +        end
    1.24 +        if not timing_available then
    1.25 +          error('Invalid timing')
    1.26 +        end
    1.27 +      end
    1.28 +      local timing = config.free_timing.calculate_func(policy, free_timing_string)
    1.29 +      if not timing then
    1.30 +        error("error in free timing config")
    1.31 +      end
    1.32 +      issue.discussion_time = timing.discussion
    1.33 +      issue.verification_time = timing.verification
    1.34 +      issue.voting_time = timing.voting
    1.35 +    end
    1.36 +    
    1.37    end
    1.38    
    1.39    issue:save()

Impressum / About Us