no edit summary
(Created page with "local util_args = require('Module:ArgsUtil') local util_cargo = require("Module:CargoUtil") local util_esports = require("Module:EsportsUtil") local util_html = require("Modul...") |
|||
p.DEBUG = false
p.CONTRACT_DATES = {}
function p:init(args, name)
self.COLUMNS[#self.COLUMNS+1] = 'PreloadJoin'
self.COLUMNS[#self.COLUMNS+1] = 'PreloadLeave'
-- self.COLUMNS[#self.COLUMNS+1] = 'SisterTeamPage'
-- self.COLUMNS[#self.COLUMNS+1] = 'ContractEnd'
-- self.COLUMNS[#self.COLUMNS+1] = 'RoleModifier'
self.COLUMNS[#self.COLUMNS+1] = 'NextTeam'
self.COLUMNS[#self.COLUMNS+1] = 'changeIndex'
end
'ResidencyChanges=ResChange',
'Contracts',
'TeamRedirects=TRed',
'SisterTeams=ST1',
'SisterTeams=ST2',
}
return ret
'News.NewsId=ResChange.NewsId',
'News.NewsId=Contracts.NewsId',
'Contracts.Team=ST1.Team',
'RC.Team=TRed.AllName',
'RC.Team=ST2.Team',
}
return ret
local fields = self:super('getFields')
local newFields = {
'RN.OriginalName=
'ResChange.ResidencyOld=
'News._pageName=ResPageName',
'Contracts.ContractEnd',
'Contracts.Team=ContractTeam',
'TRed._pageName=TeamPage',
'COALESCE(ST1._pageName, ST2._pageName, Contracts.Team, RC.Team)=SisterTeamPage',
}
return util_table.mergeArrays(fields, newFields)
-- format raw data rows
function p:formatOneNonRCRow(row)
if not row.ContractEnd then return end
self.CONTRACT_DATES[row.SisterTeamPage] = row.ContractEnd
end▼
function p:formatOneRawDataRow(row)
-- dealing with contracts here will bring information *forward* when a player is on same sister team
-- and we want to preserve the fact that they had a contract already
-- this construction is done as we sort through the changes and apply formatting
-- later on we'll go back through the entire thing a 2nd time to do "after-the-fact" information
-- which will apply "normal" contract information, when contract info is stored *after* the
-- joining-the-team roster change in question
self:super('formatOneRawDataRow', row)
local potentialContractDate = self.CONTRACT_DATES[row.SisterTeamPage]
if row.Date_SortJoin and potentialContractDate and potentialContractDate > row.Date_SortJoin then
row.ContractEnd = potentialContractDate
end▼
end▼
function p:getKey(row)
local key =
row.Team or '',
return key .. self:getAndSetMeaningfulStatus(row)▼
row.RoleModifier or 'Normal',
row.Role or 'Unknown',
)
end
function h.updateRowAncillaryInformationIfNeeded(outputRow, queryRow)
-- only update for stuff where the player already left the team▼
if not outputRow.TeamLeave then
-- information that needs to get updated when the player is CURRENTLY on
-- the team. This includes contract information.
h.updateAncillaryInformationOnCurrentTeamsIfNeeded(outputRow, queryRow)
-- do not continue to do the only-after-they-left stuff
end
for _, v in ipairs({ 'NameLeave', 'ResidencyLeave', }) do▼
-- these are PRE-CHANGE values, so when they occur it means only apply them
-- if you're still on the team, either the NEXT old one will apply, or the one in infobox will apply
h.updateAncillaryValueInRow(outputRow, queryRow, v)
end
function p:isOriginalNews(changesByLine, row, index)
if not index then return true end
if not index
for _, oldChangeLineKey in ipairs(index
return false
end
end
function
if row.TeamJoin and not
return h.teamsWhenAreIdentical(row, oldRow, 'Join')▼
end▼
return false▼
end
function
for _, v in ipairs({ 'Team', 'RoleModifier', 'Role' }) do▼
if row[v .. when] ~= oldRow[v .. when] then▼
return false▼
end▼
end▼
return true
if not row.TeamLeave then return true end
return not index
end
function p:
return changesByLine[oldChangeLineKey.changeNumber]
▲ -- end
end
function p:
return index[#index].changeNumber
end
function p:updateIndex(changesByLine, row, index)
end
if line.TeamLeave then return end
util_table.merge(line, row)
▲end
▲function p:moveExistingLine(changesByLine, oldIndex)
▲ return
▲end
▲function h.isThisLineARepeatOfAnOldOne(row, oldRow)
▲ return h.teamsWhenAreIdentical(row, oldRow, 'Join')
▲ end
▲ return false
▲end
▲ for _, v in ipairs({ 'Team', 'RoleModifier', 'Role' }) do
▲ if row[v .. when] ~= oldRow[v .. when] then
▲ return false
▲ end
▲ end
▲ return true
end
if queryRow.Direction == 'Leave' then return end
for _, outputRow in ipairs(changesByLine) do
-- we can't add a NextTeam if they're still on the team
else
outputRow.NextTeam = outputRow.NextTeam or queryRow.Team
outputRow.changeIndexNext = 'queryRow.index'
end
end
end
|