fixed bug where getting org by name wouldn't work

This commit is contained in:
Luke Miller 2021-04-15 00:13:04 -04:00
parent 4abee2e603
commit ce56ec3fd6

View File

@ -9,16 +9,17 @@ modpol.orgs.__index = modpol.orgs
-- ==================================================
-- returns org when given its id or name
function modpol.orgs.get_org(id)
if type(id) == 'string' then
function modpol.orgs.get_org(arg)
if type(arg) == 'string' then
for id, org in ipairs(modpol.orgs.array) do
if org.name == id then
if org.name == arg then
return org
end
end
elseif type(id) == 'number' then
return modpol.orgs.array[id]
elseif type(arg) == 'number' then
return modpol.orgs.array[arg]
end
return nil
end
-- ===============================================