Module:AirdateOrder

From Itora Wiki

This Module provides the order in which sessions occurred. It is called by Template:Infobox Episode, and should be updated as soon as sessions occur, along with Module:Ep/Switcher.


local p = {}
 
function p.airdateOrder(frame, reference)
    local epSwitcher = require("Module:Ep/Switcher")
    local reference = false
    local epName, CxEE = epSwitcher.epSwitcher(frame, reference)
    local order = frame.args["order"]
 
    epArray = {
        "1x01", -- 2020-12-28
        "1x02", -- 2021-01-02
        "1xDT01", -- 2021-01-03 to 2021-01-15
        "1x03", -- 2021-01-16
        "1x04", -- 2021-01-23
        "1x05", -- 2021-02-06
        "1xDT02", -- 2021-02-07 to 2021-02-19
        "1x06", -- 2021-02-27
        "OSx01", -- 2021-03-14
        "1x07", -- 2021-03-20
        "1x08", -- 2021-03-27
        "1x09", -- 2021-04-03
        "1x10", -- 2021-04-10
        "1x11", -- 2021-04-17
        "1x12", -- 2021-04-24
        "1xDT03", -- 2021-04-25 to 2021-05-08
        "1x13", -- 2021-05-08
        "1x14", -- 2021-05-15
        "1x15", -- 2021-05-28
        "1x16", -- 2021-06-12
        "1x17", -- 2021-06-19
        "1x18", -- 2021-07-03
        "1x19", -- 2021-07-17
        "1x20", -- 2021-07-24
        "1x21", -- 2021-07-31
        "1x22", -- 2021-08-14
        "1x23", -- 2021-08-21
        "1x24", -- 2021-09-04
        "1x25", -- 2021-09-18
        "1xDT04", -- 2021-09-19 to 2022-05-27
        "1xOS01", -- 2021-11-12
        "1xOS02", -- 2022-01-22
        "1xOS03", -- 2022-01-29 to 2022-02-23
        "1xOS04", -- 2022-03-19
        "1xOS05", -- 2022-05-08
        "1x26", -- 2022-05-28
        "1x27", -- 2022-06-04
        "1x28", -- 2022-06-18
        "1x29", -- 2022-06-25
        "1x30", -- 2022-07-03
        "1x31", -- 2022-07-09
        "1x32", -- 2022-07-10 to 2022-07-22
        "1x33", -- 2022-07-23
        "1x34", -- 2022-08-06
        "1x35", -- 2022-08-12
        "1x36", -- 2022-08-20
        "1x37", -- 2022-09-03
        "1x38", -- 2022-09-10
        "1x39", -- 2022-09-17
        "1x40", -- 2022-09-24
        "1x41", -- 2022-10-01
        "1x42", -- 2022-10-15
        "1x43", -- 2022-10-29
        "1x44", -- 2022-11-12
        "1x45", -- 2022-11-19
        "1x46", -- 2022-11-26
        "1x47", -- 2022-12-03
        "OSx02", -- 2022-12-11
        "1x48", -- 2023-01-07
        "1x49", -- 2023-01-14
        "1x50", -- 2023-01-21
        "OSx03", -- 2023-01-22
        "1x51", -- 2023-02-04
        "1x52", -- 2023-02-18
        "1x53", -- 2023-02-25
        "1x54", -- 2023-03-04
        "OSx04", -- 2023-03-07
        "1x55", -- 2023-03-11
        "1x56", -- 2023-03-18
        "1x57", -- 2023-03-25
        "1x58", -- 2023-04-01
        "1x59", -- 2023-04-08
        "1x60", -- 2023-04-29
        "1x61", -- 2023-05-06
        "1x62", -- 2023-05-13
        "1x63", -- 2023-05-20
        "2x01", -- 2023-07-04
        "2x02", -- 2023-07-14
        "2x03", -- 2023-08-13
        "2x04", -- 2023-08-28
        "2x05", -- 2023-09-17
    }
 
    if order == "next" then CxEE = p.nextEp(epArray, CxEE)
    elseif order == "prev" then CxEE = p.prevEp(epArray, CxEE) end
 
 
    return frame:preprocess(CxEE)
end
 
function p.nextEp(epArray, CxEE)
    local index = 0
    local i = 1;
    while epArray[i] do
        if epArray[i] == CxEE
            then index = i + 1
                 break end
        i = i + 1
    end
 
    if epArray[index] then CxEE = "{{ep|" .. epArray[index] .. "}}"
    else CxEE = "N/A" end
 
    return CxEE
 
end
 
function p.prevEp(epArray, CxEE)
    local index = 0
    local i = 1;
    while epArray[i] do
        if epArray[i] == CxEE
            then index = i - 1
                 break end
        i = i + 1
    end
 
    if epArray[index] then CxEE = "{{ep|" .. epArray[index] .. "}}"
    else CxEE = "N/A" end
 
    return CxEE
 
end
 
 
return p