moving how pending actions work around, after some testing and discussion. reordered how new processes are created so that they have access to their own ids
This commit is contained in:
@@ -8,9 +8,9 @@ modpol.modules.consent.__index = modpol.modules.consent
|
||||
function temp_consent_process()
|
||||
return {
|
||||
type = "consent",
|
||||
id = nil,
|
||||
org_id = nil,
|
||||
request_id = nil,
|
||||
actions = {},
|
||||
total_votes = 0,
|
||||
majority_to_pass = 0.51,
|
||||
votes_yes = {},
|
||||
@@ -20,23 +20,20 @@ end
|
||||
|
||||
-- ===============================================
|
||||
-- function to create a new consent process to resolve a pending process
|
||||
function modpol.modules.consent:new_process(request_id, org_id)
|
||||
function modpol.modules.consent:new_process(id, request_id, org_id)
|
||||
local process = temp_consent_process()
|
||||
process.id = id
|
||||
process.request_id = request_id
|
||||
process.org_id = org_id
|
||||
|
||||
setmetatable(process, modpol.modules.consent)
|
||||
modpol.ocutil.log('Created new process for request id #' .. request_id)
|
||||
|
||||
-- adding new pending action for all users in the org to vote on the request
|
||||
local process_org = modpol.orgs.get_org(org_id)
|
||||
for k, member in ipairs(process_org.members) do
|
||||
process.actions[member] = {'approve'}
|
||||
end
|
||||
|
||||
return process
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- =========================================
|
||||
-- function to delete a process, called when process finishes
|
||||
function modpol.modules.consent:delete()
|
||||
|
Reference in New Issue
Block a user