liquid_feedback_frontend

view model/delegation.lua @ 953:3b74187efaa3

Added missing html encoding to diff output
author bsw
date Mon Dec 10 19:59:30 2012 +0100 (2012-12-10)
parents 42afe0765f86
children 81bde33c2256
line source
1 Delegation = mondelefant.new_class()
2 Delegation.table = 'delegation'
4 Delegation:add_reference{
5 mode = 'm1',
6 to = "Member",
7 this_key = 'truster_id',
8 that_key = 'id',
9 ref = 'truster',
10 }
12 Delegation:add_reference{
13 mode = 'm1',
14 to = "Member",
15 this_key = 'trustee_id',
16 that_key = 'id',
17 ref = 'trustee',
18 }
20 Delegation:add_reference{
21 mode = 'm1',
22 to = "Unit",
23 this_key = 'unit_id',
24 that_key = 'id',
25 ref = 'unit',
26 }
28 Delegation:add_reference{
29 mode = 'm1',
30 to = "Area",
31 this_key = 'area_id',
32 that_key = 'id',
33 ref = 'area',
34 }
36 Delegation:add_reference{
37 mode = 'm1',
38 to = "Issue",
39 this_key = 'issue_id',
40 that_key = 'id',
41 ref = 'issue',
42 }
44 function Delegation:by_pk(truster_id, unit_id, area_id, issue_id)
45 local selector = self:new_selector():optional_object_mode()
46 selector:add_where{ "truster_id = ?", truster_id }
47 if unit_id then
48 selector:add_where{ "unit_id = ?", unit_id }
49 else
50 selector:add_where("unit_id ISNULL")
51 end
52 if area_id then
53 selector:add_where{ "area_id = ?", area_id }
54 else
55 selector:add_where("area_id ISNULL")
56 end
57 if issue_id then
58 selector:add_where{ "issue_id = ? ", issue_id }
59 else
60 selector:add_where("issue_id ISNULL ")
61 end
62 return selector:exec()
63 end
65 function Delegation:selector_for_broken(member_id)
66 return Delegation:new_selector()
67 :left_join("issue", nil, "issue.id = delegation.issue_id")
68 :add_where("issue.id ISNULL OR issue.closed ISNULL")
69 :join("member", nil, "delegation.trustee_id = member.id")
70 :add_where{"delegation.truster_id = ?", member_id}
71 :add_where{"member.active = 'f' OR (member.last_activity IS NULL OR age(member.last_activity) > ?::interval)", config.delegation_warning_time }
72 end

Impressum / About Us