Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Maxim/acm
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {}; local function majority ( frame ) -- input args: -- n-total-arbs, n-inactive-arbs, n-recused-arbs, n-abstained-arbs, n-is-motion local acm if frame.args.motion=="yes" or frame.args.motion=="plural" then acm = math.floor((frame.args.active - (frame.args.inactive + frame.args.recused + frame.args.abstain)) / 2) + 1 else acm = math.floor((frame.args.active - (frame.args.inactive + frame.args.recused)) / 2) + 1 end return acm end local function active ( frame ) return frame.args.active - frame.args.inactive - frame.args.recused end p.readactive = function ( frame ) -- cast stuff to numbers local nArbitrators = tonumber(frame.args.active) local nInactive = tonumber(frame.args.inactive) local nRecused = tonumber(frame.args.recused) local nAbstain = tonumber(frame.args.abstain) -- determine if we have a case, motion, or motions local proceeding = "this case" if frame.args.motion=="yes" then proceeding = "this motion" end if frame.args.motion=="plural" then proceeding = "these motions" end local out_text = "For " .. proceeding .. ", there are " .. active(frame) .. " active arbitrators. " -- report on inactive and recused arbs that are subtracted out of all majorities local subtract_text if nInactive > 0 or nRecused > 0 then local arb = "arbitrator" subtract_text = "There is " if (nInactive + nRecused) > 1 then arb = "arbitrators" subtract_text = "There are " end if nInactive < 1 then subtract_text = subtract_text .. " " .. frame.args.recused .. " recused " .. arb .. ". " elseif nRecused < 1 then subtract_text = subtract_text .. " " .. frame.args.inactive .. " inactive " .. arb .. ". " else subtract_text = subtract_text .. " " .. frame.args.recused .. " recused and " .. frame.args.inactive .. " inactive " .. arb .. ". " end out_text = out_text .. subtract_text end -- now give majority count (or abstains + majority count for motions) local maj_text if frame.args.motion=="yes" or frame.args.motion=="plural" then -- plural or not plural arbitrators local arb_text = "is 1 abstaining arbitrator, " if (nAbstain > 1) then arb_text = "are " .. frame.args.abstain .. " abstaining arbitrators, " end maj_text = "Since there " .. arb_text else maj_text = "Therefore, " end maj_text = maj_text .. majority(frame) .. " support or oppose votes are a majority." out_text = out_text .. maj_text return out_text end p.abstentionrange = function ( frame ) local out_text = "0β1" if math.fmod(active(frame),2)==0 then out_text = "0" end return out_text end p.abstention_maj_r1 = function ( frame ) return majority ( frame ) end p.abstention_maj_r2 = function ( frame ) return majority ( frame ) - 1 end p.abstention_maj_r3 = function ( frame ) return majority ( frame ) - 2 end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Maxim/acm/doc
(
edit
)