Module:SelectServiceAward/sandbox

Used by {{service awards}}

Module:SelectServiceAward/sandbox
local p = {}

--A table with the edit requirements for each stage (descending order)
local editreq = {175000, 150000, 132000, 114000, 96000, 78000, 60000, 51000, 42000, 33000, 28500, 24000, 20000, 16000, 12000, 8000, 6000, 5500, 5000, 4500,
	4000, 3500, 3000, 2500, 2000, 1750, 1500, 1250, 1000, 800, 600, 400, 200, 150, 100, 50, 1}

--A table with the account age requirements for each stage (descending order)
local edittime = {'20 years', '18 years', '16 years', '14 years', '12 years', '10 years', '8 years', '7 years', '6 years', '5 years', '4 years + 6 months', 
	'4 years', '3 years + 6 months', '3 years', '2 years + 6 months', '2 years', '1 year + 6 months', '1 year + 4 months + 15 days', '1 year + 3 months', 
	'1 year + 1 month + 15 days', '1 year', '10 months + 15 days', '9 months', '7 months + 15 days', '6 months', '5 months + 8 days', '4 months + 15 days', 
	'3 months + 23 days', '3 months', '2 months + 15 days', '2 months', '1 month + 15 days', '1 month', '23 days', '15 days', '8 days', '1 day'}

function p.main(frame)
	local numedits = tonumber(frame.args.edits)
	local date = frame.args.date
	local noincremental = frame.args.noinc
	local numpos = 0
	
	local time = tonumber(frame:callParserFunction('#time', 'U'))
	
	for i=1, 37 do
		if numedits >= editreq[i] and numpos == 0 then
			local timestr = date .. " + " .. edittime[i]
			local acctime = tonumber(frame:callParserFunction('#time', 'U', timestr))
			if time >= acctime then
				numpos = (38 - i)
			end
		end
	end
	if noincremental == "yes" and numpos > 0 and numpos <= 20 then
		local counter = math.floor( ( numpos - 1 ) / 4 )
		numpos = ( 4 * counter ) + 1
	end
	return (numpos)
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.