annotate app/main/admin/_action/policy_update.lua @ 1529:87e2a58bef9e
Fixed add_support for usage without access token
 | author | 
 bsw | 
 | date | 
 Mon Sep 14 18:31:20 2020 +0200 (2020-09-14) | 
 | parents | 
 c5d3f93df7ed  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@194
 | 
     1 local policy = Policy:by_id(param.get_id()) or Policy:new()
 | 
| 
bsw@194
 | 
     2 
 | 
| 
bsw@194
 | 
     3 param.update(
 | 
| 
bsw@194
 | 
     4   policy, 
 | 
| 
bsw@194
 | 
     5   "index", "name", "description", "active", 
 | 
| 
bsw@1234
 | 
     6   "min_admission_time", "max_admission_time", "discussion_time", "verification_time", "voting_time", 
 | 
| 
bsw/jbe@1309
 | 
     7   "issue_quorum", "issue_quorum_num", "issue_quorum_den",
 | 
| 
bsw/jbe@1309
 | 
     8   "initiative_quorum", "initiative_quorum_num", "initiative_quorum_den", 
 | 
| 
bsw@1484
 | 
     9   "direct_majority_num", "direct_majority_den", "direct_majority_positive", "direct_majority_non_negative",
 | 
| 
bsw@282
 | 
    10   "indirect_majority_num", "indirect_majority_den", "indirect_majority_strict", "indirect_majority_positive", "indirect_majority_non_negative",
 | 
| 
bsw@897
 | 
    11   "no_reverse_beat_path", "no_multistage_majority", "polling"
 | 
| 
bsw@194
 | 
    12 )
 | 
| 
bsw@194
 | 
    13 
 | 
| 
bsw@1484
 | 
    14 if param.get("direct_majority_strict") == "1" then 
 | 
| 
bsw@1484
 | 
    15   policy.direct_majority_strict = true 
 | 
| 
bsw@1484
 | 
    16 else 
 | 
| 
bsw@1484
 | 
    17   policy.direct_majority_strict = false 
 | 
| 
bsw@1484
 | 
    18 end
 | 
| 
bsw@1484
 | 
    19 
 | 
| 
bsw@1234
 | 
    20 if policy.min_admission_time == "" then policy.min_admission_time = nil end
 | 
| 
bsw@1234
 | 
    21 if policy.max_admission_time == "" then policy.max_admission_time = nil end
 | 
| 
bsw@901
 | 
    22 if policy.discussion_time == "" then policy.discussion_time = nil end
 | 
| 
bsw@901
 | 
    23 if policy.verification_time == "" then policy.verification_time = nil end
 | 
| 
bsw@901
 | 
    24 if policy.voting_time == "" then policy.voting_time = nil end
 | 
| 
bsw@897
 | 
    25 
 | 
| 
bsw@194
 | 
    26 policy:save()
 |