Browse Source

ffho-luci-ap-timer: improve fix

Karsten Böddeker 7 years ago
parent
commit
7858f410aa

+ 10 - 10
ffho/ffho-luci-ap-timer/luasrc/usr/lib/lua/luci/model/cbi/admin/ap-timer.lua

@@ -1,15 +1,20 @@
 local uci = luci.model.uci.cursor()
 
-m = Map('ap-timer', translate('AP Timer'), translate(
-  'You can setup the AP Timer here'))
-m.pageaction = false
-m.template = "admin/expertmode"
-
 if not uci:get('ap-timer','settings') then
   uci:section('ap-timer','ap-timer','settings')
   uci:save('ap-timer')
 end
 
+if not uci:get('ap-timer','all') then
+  uci:section('ap-timer','day','all')
+  uci:save('ap-timer')
+end
+
+m = Map('ap-timer', translate('AP Timer'), translate(
+  'You can setup the AP Timer here'))
+m.pageaction = false
+m.template = "admin/expertmode"
+
 s = m:section(NamedSection, 'settings', 'ap-timer', nil)
 s.addremove = false
 s.anonymous = true
@@ -21,11 +26,6 @@ o = s:option(ListValue, 'type', translate('Type'))
 o.default = 'day'
 o:value('day', translate('Daily'))
 
-if not uci:get('ap-timer','all') then
-  uci:section('ap-timer','day','all')
-  uci:save('ap-timer')
-end
-
 s = m:section(NamedSection, 'all', 'day', translate('Daily'))
 s.addremove = false
 s.anonymous = true