local p = {}
ridershipDataYear = 2015
ridershipData = {}
ridershipData[ 4] = { 33, 10595.83}
ridershipData[ 6] = {220, 15.58}
ridershipData[ 8] = {149, 459.16}
ridershipData[ 9] = {191, 88.83}
ridershipData[ 10] = {216, 21.39}
ridershipData[ 12] = {121, 1204.41}
ridershipData[ 14] = {218, 18.59}
ridershipData[ 15] = {128, 988.50}
ridershipData[ 18] = {157, 387.15}
ridershipData[ 20] = {206, 37.38}
ridershipData[ 22] = {204, 43.93}
ridershipData[ 25] = { 83, 2585.13}
ridershipData[ 27] = {221, 14.50}
ridershipData[ 29] = {124, 1116.23}
ridershipData[ 31] = {189, 98.46}
ridershipData[ 32] = {219, 18.00}
ridershipData[ 34] = {131, 882.78}
ridershipData[ 35] = {186, 108.46}
ridershipData[ 36] = {137, 679.45}
ridershipData[ 37] = {210, 35.16}
ridershipData[ 40] = {177, 199.57}
ridershipData[ 41] = {147, 517.00}
ridershipData[ 42] = {207, 36.93}
ridershipData[ 43] = {144, 581.74}
ridershipData[ 45] = {136, 711.85}
ridershipData[ 51] = { 12, 29773.50}
ridershipData[ 52] = {146, 517.45}
ridershipData[ 53] = {211, 35.01}
ridershipData[ 54] = { 46, 6369.34}
ridershipData[ 55] = {192, 87.30}
ridershipData[ 56] = {188, 98.99}
ridershipData[ 57] = {118, 1263.14}
ridershipData[ 58] = {203, 45.42}
ridershipData[ 60] = {209, 35.30}
ridershipData[ 62] = { 90, 2281.00}
ridershipData[ 63] = {139, 666.36}
ridershipData[ 64] = {202, 47.31}
ridershipData[ 66] = {111, 1459.96}
ridershipData[ 67] = { 41, 7464.04}
ridershipData[ 68] = {201, 47.70}
ridershipData[ 69] = {119, 1212.00}
ridershipData[ 70] = { 28, 12598.60}
ridershipData[ 71] = {196, 63.85}
ridershipData[ 72] = {171, 268.62}
ridershipData[ 73] = { 35, 10302.15}
ridershipData[ 74] = {169, 275.15}
ridershipData[ 75] = { 66, 3744.06}
ridershipData[ 76] = {167, 284.54}
ridershipData[ 77] = { 74, 3270.15}
ridershipData[ 78] = {175, 227.56}
ridershipData[ 79] = {176, 206.37}
ridershipData[ 80] = {151, 434.00}
ridershipData[ 81] = {153, 418.31}
ridershipData[ 82] = {194, 67.90}
ridershipData[ 83] = { 86, 2470.99}
ridershipData[ 84] = {152, 433.19}
ridershipData[ 85] = { 97, 1824.52}
ridershipData[ 86] = {172, 266.98}
ridershipData[ 87] = {178, 193.74}
ridershipData[ 88] = {102, 1586.74}
ridershipData[ 89] = { 27, 12909.93}
ridershipData[ 90] = {127, 1007.88}
ridershipData[ 91] = {143, 582.42}
ridershipData[ 92] = { 19, 16458.60}
ridershipData[ 93] = { 51, 5265.09}
ridershipData[ 94] = { 30, 11903.49}
ridershipData[ 95] = { 75, 3175.05}
ridershipData[ 96] = { 15, 18782.70}
ridershipData[ 97] = { 23, 14813.89}
ridershipData[ 98] = { 10, 31786.13}
ridershipData[100] = { 1, 129531.90}
ridershipData[101] = { 39, 8271.57}
ridershipData[102] = { 7, 42642.00}
ridershipData[103] = { 9, 32282.51}
ridershipData[104] = { 68, 3629.62}
ridershipData[105] = { 16, 17731.15}
ridershipData[106] = { 2, 60655.54}
ridershipData[107] = { 17, 16515.90}
ridershipData[108] = { 3, 57239.99}
ridershipData[109] = { 32, 10629.09}
ridershipData[110] = { 34, 10317.25}
ridershipData[111] = { 73, 3317.87}
ridershipData[112] = { 40, 8006.98}
ridershipData[113] = { 36, 9829.50}
ridershipData[114] = { 37, 9512.10}
ridershipData[115] = { 6, 42805.93}
ridershipData[116] = {125, 1075.76}
ridershipData[117] = {159, 367.45}
ridershipData[118] = { 18, 16470.22}
ridershipData[119] = {197, 63.14}
ridershipData[120] = {170, 273.34}
ridershipData[121] = { 82, 2604.23}
ridershipData[122] = {198, 62.81}
ridershipData[123] = {150, 455.98}
ridershipData[124] = {183, 135.16}
ridershipData[125] = { 98, 1822.45}
ridershipData[126] = { 78, 2911.93}
ridershipData[127] = {145, 577.21}
ridershipData[128] = { 55, 5032.63}
ridershipData[129] = {181, 155.56}
ridershipData[130] = { 89, 2333.01}
ridershipData[131] = { 58, 4711.14}
ridershipData[132] = {110, 1462.35}
ridershipData[133] = {133, 860.56}
ridershipData[134] = {129, 928.27}
ridershipData[135] = {141, 593.36}
ridershipData[136] = {138, 671.33}
ridershipData[137] = { 26, 13145.89}
ridershipData[138] = {180, 173.96}
ridershipData[139] = {107, 1499.50}
ridershipData[140] = {101, 1647.82}
ridershipData[142] = {135, 764.33}
ridershipData[143] = { 62, 4028.48}
ridershipData[144] = { 21, 15554.18}
ridershipData[145] = { 52, 5101.13}
ridershipData[146] = { 4, 53734.24}
ridershipData[147] = {100, 1675.76}
ridershipData[148] = {106, 1530.50}
ridershipData[149] = { 11, 30009.09}
ridershipData[150] = { 93, 2011.05}
ridershipData[151] = { 20, 16436.81}
ridershipData[152] = {134, 830.84}
ridershipData[153] = { 85, 2480.92}
ridershipData[154] = { 45, 6525.21}
ridershipData[155] = { 79, 2834.31}
ridershipData[156] = {109, 1484.95}
ridershipData[157] = {165, 298.59}
ridershipData[158] = { 25, 14061.59}
ridershipData[159] = { 54, 5064.50}
ridershipData[160] = {173, 258.86}
ridershipData[161] = { 71, 3386.77}
ridershipData[162] = { 63, 4024.02}
ridershipData[163] = { 13, 21383.59}
ridershipData[164] = {115, 1318.92}
ridershipData[165] = {154, 411.59}
ridershipData[166] = {117, 1281.27}
ridershipData[167] = { 31, 11233.45}
ridershipData[168] = { 95, 2004.47}
ridershipData[169] = {122, 1199.62}
ridershipData[170] = { 70, 3415.14}
ridershipData[171] = {163, 309.18}
ridershipData[172] = { 42, 7272.10}
ridershipData[173] = { 49, 5618.13}
ridershipData[174] = { 44, 6670.35}
ridershipData[175] = { 5, 53051.45}
ridershipData[176] = { 67, 3652.96}
ridershipData[177] = {126, 1027.64}
ridershipData[178] = { 61, 4052.47}
ridershipData[179] = { 65, 3795.80}
ridershipData[180] = { 47, 6025.76}
ridershipData[181] = { 77, 2956.02}
ridershipData[183] = { 50, 5292.55}
ridershipData[184] = { 92, 2106.71}
ridershipData[185] = { 8, 41437.07}
ridershipData[186] = { 38, 8824.32}
ridershipData[187] = {116, 1284.53}
ridershipData[188] = { 88, 2412.45}
ridershipData[189] = {179, 180.73}
ridershipData[190] = { 14, 20853.86}
ridershipData[191] = {184, 128.10}
ridershipData[192] = {190, 92.57}
ridershipData[193] = {148, 470.81}
ridershipData[194] = {161, 336.66}
ridershipData[195] = { 57, 4880.48}
ridershipData[196] = {158, 382.86}
ridershipData[197] = {114, 1326.29}
ridershipData[198] = {205, 42.50}
ridershipData[199] = {132, 861.13}
ridershipData[200] = {168, 280.58}
ridershipData[201] = {185, 112.34}
ridershipData[203] = { 96, 1939.78}
ridershipData[204] = {217, 21.10}
ridershipData[205] = {224, 1.00}
ridershipData[206] = {222, 3.28}
ridershipData[209] = {223, 2.06}
ridershipData[211] = {156, 395.74}
ridershipData[213] = {199, 60.34}
ridershipData[215] = {142, 583.76}
ridershipData[217] = {162, 316.44}
ridershipData[219] = {123, 1189.00}
ridershipData[220] = {208, 35.96}
ridershipData[280] = { 29, 12193.60}
ridershipData[288] = { 22, 14967.51}
ridershipData["竹東車站"] = {120, 1206.64}
ridershipData["汐科車站"] = {24, 14123.95}
ridershipData["大橋車站"] = {43, 6885.47}
ridershipData["太原車站"] = {48, 5634.06}
ridershipData["浮洲車站"] = {53, 5073.10}
ridershipData["百福車站"] = {56, 4883.40}
ridershipData["六家車站"] = {59, 4404.37}
ridershipData["大慶車站"] = {60, 4404.08}
ridershipData["沙崙車站"] = {64, 3861.39}
ridershipData["北新竹車站"] = {69, 3525.51}
ridershipData["菁桐車站"] = {72, 3335.17}
ridershipData["新莊車站 (新竹市)"] = {76, 3048.27}
ridershipData["海科館車站"] = {80, 2762.70}
ridershipData["十分車站"] = {81, 2619.56}
ridershipData["三坑車站"] = {84, 2488.77}
ridershipData["南科車站"] = {87, 2452.31}
ridershipData["北湖車站"] = {91, 2133.21}
ridershipData["長榮大學車站"] = {94, 2010.16}
ridershipData["大村車站"] = {99, 1684.71}
ridershipData["內灣車站"] = {103, 1579.47}
ridershipData["嘉北車站"] = {104, 1579.00}
ridershipData["竹中車站"] = {105, 1559.03}
ridershipData["仁德車站"] = {108, 1485.15}
ridershipData["車埕車站"] = {112, 1450.56}
ridershipData["集集車站"] = {113, 1353.67}
ridershipData["平溪車站"] = {130, 897.52}
ridershipData["千甲車站"] = {140, 618.39}
ridershipData["水里車站"] = {155, 405.12}
ridershipData["濁水車站"] = {160, 337.84}
ridershipData["榮華車站"] = {164, 304.51}
ridershipData["合興車站"] = {166, 289.11}
ridershipData["橫山車站 (新竹縣)"] = {174, 252.37}
ridershipData["上員車站"] = {182, 144.75}
ridershipData["九讚頭車站"] = {187, 105.86}
ridershipData["嶺腳車站"] = {193, 69.31}
ridershipData["龍泉車站"] = {195, 64.07}
ridershipData["源泉車站"] = {200, 50.93}
ridershipData["望古車站"] = {212, 34.02}
ridershipData["大華車站"] = {213, 31.73}
ridershipData["富貴車站"] = {214, 30.85}
ridershipData["南樹林車站"] = {215, 23.28}
function p._formatnum(value, digit)
if value == 0 then
if digit == 1 then
return 0
else
return ""
end
end
result = p._formatnum(math.floor(value/10), digit+1)
digitData = value%10
if (digit > 3) and ((digit%3) == 1) then
return result .. digitData .. ","
else
return result .. digitData
end
end
function p.rank(frame)
-- Allow for invocation via #invoke or directly from another module
local args
if frame == mw.getCurrentFrame() then
args = frame.args
else
args = frame
end
local stationID = args.stationID
local requestField = args.requestField
local nStationID = tonumber(stationID)
local nRequestField
if requestField == nil then
nRequestField = 4
else
nRequestField = tonumber(requestField)
if type(nRequestField) ~= "number" then
return type(nRequestField) .. requestField
end
if nRequestField > 4 then
nRequestField = 4
elseif nRequestField < 1 then
-- show one at least
nRequestField = 4
end
end
for indexID, targetRidership in pairs(ridershipData) do
if (indexID == nStationID) or (indexID == stationID) then
if nRequestField == 1 then
return p._formatnum(math.floor(targetRidership[2]+0.5),1)
elseif nRequestField == 2 then
return targetRidership[1]
elseif nRequestField == 3 then
return ridershipDataYear
elseif nRequestField == 4 then
return p._formatnum(math.floor(targetRidership[2]+0.5),1) .. ",第" .. targetRidership[1] .. "名(" .. ridershipDataYear .. "年)"
end
end
end
if nRequestField == 4 then
return "無資料"
else
return "-"
end
end
return p