liquid_feedback_frontend

view model/survey.lua @ 1819:85ca5a7e46ec

Fixed image path variable in sassc variables
author bsw
date Tue Jan 25 00:46:06 2022 +0100 (2022-01-25)
parents 5a8a09119865
children
line source
1 Survey = mondelefant.new_class()
2 Survey.table = 'survey'
4 Survey:add_reference{
5 mode = '1m',
6 to = "SurveyQuestion",
7 this_key = 'id',
8 that_key = 'survey_id',
9 ref = 'questions',
10 back_ref = 'survey',
11 default_order = 'position'
12 }
15 local new_selector = Survey.new_selector
17 function Survey:new_selector()
18 local selector = new_selector(self)
19 selector:add_field("CASE WHEN (open_until NOTNULL AND open_until > now()) THEN open_until - now() ELSE NULL END", "time_left")
20 return selector
21 end
23 function Survey:get_open()
24 return self:new_selector()
25 :add_where("open_from < now() and open_until > now()")
26 :optional_object_mode()
27 :exec()
28 end
30 function Survey.object_get:open()
31 if self.open_from < atom.timestamp:get_current() and self.open_until > atom.timestamp:get_current() then
32 return true
33 end
34 return false
35 end

Impressum / About Us