liquid_feedback_frontend
view model/policy.lua @ 945:b865f87ea810
Work on robustification of JavaScript voting
author | jbe |
---|---|
date | Thu Nov 08 13:17:37 2012 +0100 (2012-11-08) |
parents | bbe07befa4e4 |
children | 8288027edb54 |
line source
1 Policy = mondelefant.new_class()
2 Policy.table = 'policy'
4 Policy:add_reference{
5 mode = '1m',
6 to = "Issue",
7 this_key = 'id',
8 that_key = 'policy_id',
9 ref = 'issues',
10 back_ref = 'policy'
11 }
13 local new_selector = Policy.new_selector
15 function Policy:new_selector()
16 local selector = new_selector(self)
17 selector:add_field("justify_interval(admission_time)::text", "admission_time_text")
18 selector:add_field("justify_interval(discussion_time)::text", "discussion_time_text")
19 selector:add_field("justify_interval(verification_time)::text", "verification_time_text")
20 selector:add_field("justify_interval(voting_time)::text", "voting_time_text")
21 return selector
22 end
25 function Policy:build_selector(args)
26 local selector = self:new_selector()
27 if args.active ~= nil then
28 selector:add_where{ "active = ?", args.active }
29 end
30 selector:add_order_by("index")
31 return selector
32 end
34 function Policy.object_get:free_timeable()
35 if self.discussion_time == nil and self.verification_time == nil and self.voting_time == nil then
36 return true
37 end
38 return false
39 end