added an actions table to processes, which lists the actions required of each user

This commit is contained in:
Luke Miller 2021-06-08 23:09:54 -04:00
parent 37f1b48466
commit 1890534195
2 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,7 @@ function temp_consent_process()
type = "consent",
org_id = nil,
request_id = nil,
actions = {},
total_votes = 0,
majority_to_pass = 0.51,
votes_yes = {},
@ -27,6 +28,12 @@ function modpol.modules.consent:new_process(request_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

View File

@ -33,13 +33,14 @@ new_request = {
params = {"new_org"}
}
request_id = modpol.instance:make_request(new_request)
modpol.instance:add_member('luke')
modpol.instance:add_member('josh')
modpol.instance:add_member('nathan')
request_id = modpol.instance:make_request(new_request)
for id, process in ipairs(modpol.instance.processes) do
process:approve('luke', true)
-- process:approve('luke', true)
process:approve('josh', true)
end