annotate model/vote.lua @ 837:92fffd09deee
Added example config for public message of the day
author |
bsw |
date |
Fri Jul 13 22:55:43 2012 +0200 (2012-07-13) |
parents |
afd9f769c7ae |
children |
|
rev |
line source |
bsw/jbe@0
|
1 Vote = mondelefant.new_class()
|
bsw/jbe@0
|
2 Vote.table = 'vote'
|
bsw/jbe@5
|
3 Vote.primary_key = { "initiative_id", "member_id" }
|
bsw/jbe@0
|
4
|
bsw/jbe@0
|
5 Vote:add_reference{
|
bsw/jbe@0
|
6 mode = 'm1',
|
bsw/jbe@0
|
7 to = "Issue",
|
bsw/jbe@0
|
8 this_key = 'issue_id',
|
bsw/jbe@0
|
9 that_key = 'id',
|
bsw/jbe@0
|
10 ref = 'issue',
|
bsw/jbe@0
|
11 }
|
bsw/jbe@0
|
12
|
bsw/jbe@0
|
13 Vote:add_reference{
|
bsw/jbe@0
|
14 mode = 'm1',
|
bsw/jbe@0
|
15 to = "Initiative",
|
bsw/jbe@0
|
16 this_key = 'initiative_id',
|
bsw/jbe@0
|
17 that_key = 'id',
|
bsw/jbe@0
|
18 ref = 'initiative',
|
bsw/jbe@0
|
19 }
|
bsw/jbe@0
|
20
|
bsw/jbe@0
|
21 Vote:add_reference{
|
bsw/jbe@0
|
22 mode = 'm1',
|
bsw/jbe@0
|
23 to = "Member",
|
bsw/jbe@0
|
24 this_key = 'author_id',
|
bsw/jbe@0
|
25 that_key = 'id',
|
bsw/jbe@0
|
26 ref = 'author',
|
bsw/jbe@0
|
27 }
|
bsw/jbe@5
|
28
|
bsw/jbe@5
|
29 function Vote:by_pk(initiative_id, member_id)
|
bsw/jbe@5
|
30 return self:new_selector()
|
bsw/jbe@5
|
31 :add_where{ "initiative_id = ? AND member_id = ?", initiative_id, member_id }
|
bsw/jbe@5
|
32 :optional_object_mode()
|
bsw/jbe@5
|
33 :exec()
|
bsw/jbe@5
|
34 end |