liquid_feedback_frontend
view model/session.lua @ 3:768faea1096d
Version alpha4
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
author | bsw |
---|---|
date | Mon Nov 30 12:00:00 2009 +0100 (2009-11-30) |
parents | 3bfb2fcf7ab9 |
children | ea2449916c12 |
line source
1 Session = mondelefant.new_class()
2 Session.table = 'session'
3 Session.primary_key = { 'ident' }
5 Session:add_reference{
6 mode = 'm1',
7 to = "Member",
8 this_key = 'member_id',
9 that_key = 'id',
10 ref = 'member',
11 }
13 local function random_string()
14 return multirand.string(
15 32,
16 '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
17 )
18 end
20 function Session:new()
21 local session = self.prototype.new(self) -- super call
22 session.ident = random_string()
23 session.additional_secret = random_string()
24 session:save()
25 return session
26 end
28 function Session:by_ident(ident)
29 local selector = self:new_selector()
30 selector:add_where{ 'ident = ?', ident }
31 selector:optional_object_mode()
32 return selector:exec()
33 end