Jump to content

Module:USHRseats

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Swpb (talk | contribs) at 20:38, 5 February 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.USHRseats(frame)
	state = frame.args[1]
	if mw.ustring.len(state)>2 then
		state = frame:expandTemplate{ title = 'ConvertAbbrev/ISO 3166-2/US', args = {state} }
	end

	year = frame.args[2]
	if year then
		census_number = (year - math.fmod(year,10))/10 - 177
	end
		
	AK = {'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-',  1,  1,  1,  1,  1,  1}
	AL = {'-','-','-','-',  3,  5,  7,  7,  6,  8,  8,  9,  9, 10,  9,  9,  9,  8,  7,  7,  7,  7,  7}
	AR = {'-','-','-','-','-','-',  1,  2,  3,  4,  5,  6,  7,  7,  7,  7,  6,  4,  4,  4,  4,  4,  4}
	AZ = {}
	CA = {}
	CO = {}
	CT = {}
	DE = {}
	FL = {}
	GA = {}
	HI = {}
	IA = {}
	ID = {}
	IL = {}
	IN = {}
	KS = {}
	KY = {}
	LA = {}
	MA = {}
	MD = {}
	ME = {}
	MI = {}
	MN = {}
	MO = {}
	MS = {}
	MT = {}
	NC = {}
	ND = {}
	NE = {}
	NH = {}
	NJ = {}
	NM = {}
	NV = {}
	NY = {}
	OH = {}
	OK = {}
	OR = {}
	PA = {}
	RI = {}
	SC = {}
	SD = {}
	TN = {}
	TX = {}
	UT = {}
	VA = {}
	VT = {}
	WA = {}
	WI = {}
	WV = {}
	WY = {}
	states = {AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY}

--	if census_number then
--		seats = states[state][census_number]
--	else
--		seats = states[state][#states[state]]
--	end

--	return seats

	return census_number
end

return p