Skip to content

Commit

Permalink
feat(infobox): move publisherpremier to base league infobox (#4852)
Browse files Browse the repository at this point in the history
* fix(league): move publisherpremier to base

* add this line to make "true" stored in the LPDB Fields

Otherwise things like TournamentsList does not applied the highlights because it cant see the stored entry

* Line adjustments

* customs

* adjust test cases

* unused imports

* add the missing comma

* unused

* unused also

* trying parsed data

the storage and highlight still showing fine

* Update infobox_league.lua

Still working fine

---------

Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: hjpalpha <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent 481a756 commit 6bb9a37
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 112 deletions.
7 changes: 4 additions & 3 deletions components/infobox/commons/infobox_league.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ function League:_parseArgs()
mode = args.mode,
patch = args.patch,
endPatch = args.endpatch or args.epatch or args.patch,
publishertier = Logic.readBool(args.publisherpremier),
}

data.liquipediatier, data.liquipediatiertype =
Expand Down Expand Up @@ -416,7 +417,7 @@ end
---@param args table
---@return boolean
function League:liquipediaTierHighlighted(args)
return false
return self.data.publishertier
end

--- Allows for overriding this functionality
Expand Down Expand Up @@ -450,7 +451,7 @@ function League:_definePageVariables(args)

Variables.varDefine('tournament_liquipediatier', self.data.liquipediatier)
Variables.varDefine('tournament_liquipediatiertype', self.data.liquipediatiertype)
Variables.varDefine('tournament_publishertier', self.data.publishertier)
Variables.varDefine('tournament_publishertier', tostring(self.data.publishertier))

Variables.varDefine('tournament_type', args.type)
Variables.varDefine('tournament_mode', self.data.mode)
Expand Down Expand Up @@ -521,7 +522,7 @@ function League:_setLpdbData(args, links)
prizepool = self.data.prizepoolUsd,
liquipediatier = self.data.liquipediatier,
liquipediatiertype = self.data.liquipediatiertype,
publishertier = self.data.publishertier,
publishertier = tostring(self.data.publishertier),
participantsnumber = tonumber(args.participants_number)
or tonumber(args.team_number)
or tonumber(args.player_number)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ end
---@param args table
function CustomLeague:customParseArguments(args)
self.data.mode = args.player_number and 'solo' or 'team'
self.data.publishertier = args.publisherpremier
end

return CustomLeague
12 changes: 0 additions & 12 deletions components/infobox/wikis/easportsfc/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

local Array = require('Module:Array')
local Class = require('Module:Class')
local Logic = require('Module:Logic')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Variables = require('Module:Variables')
Expand Down Expand Up @@ -71,17 +70,6 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = Logic.readBool(args.publisherpremier) and 'true' or nil
end

---@param args table
function CustomLeague:defineCustomPageVariables(args)
--Legacy vars
Expand Down
12 changes: 0 additions & 12 deletions components/infobox/wikis/honorofkings/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
local Class = require('Module:Class')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')
local String = require('Module:StringUtils')
local Variables = require('Module:Variables')

Expand Down Expand Up @@ -60,12 +59,6 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param lpdbData table
---@param args table
---@return table
Expand All @@ -75,11 +68,6 @@ function CustomLeague:addToLpdb(lpdbData, args)
return lpdbData
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = Logic.readBool(args.publisherpremier) and 'true' or nil
end

---@param args table
function CustomLeague:defineCustomPageVariables(args)
--Legacy Vars:
Expand Down
12 changes: 0 additions & 12 deletions components/infobox/wikis/omegastrikers/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

local Class = require('Module:Class')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')

local Injector = Lua.import('Module:Widget/Injector')
local League = Lua.import('Module:Infobox/League')
Expand Down Expand Up @@ -44,15 +43,4 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = tostring(Logic.readBool(args.publisherpremier))
end

return CustomLeague
12 changes: 0 additions & 12 deletions components/infobox/wikis/osu/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
local Class = require('Module:Class')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')
local String = require('Module:StringUtils')
local Variables = require('Module:Variables')

Expand Down Expand Up @@ -92,17 +91,6 @@ function CustomLeague:defineCustomPageVariables(args)
Variables.varDefine('tournament_game', Game.name{game = args.game})
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = args.publisherpremier
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param args table
---@return table
function CustomLeague:getWikiCategories(args)
Expand Down
12 changes: 0 additions & 12 deletions components/infobox/wikis/smite/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
local Class = require('Module:Class')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')

local Injector = Lua.import('Module:Widget/Injector')
local League = Lua.import('Module:Infobox/League')
Expand Down Expand Up @@ -49,15 +48,4 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = tostring(Logic.readBool(args.publisherpremier))
end

return CustomLeague
12 changes: 0 additions & 12 deletions components/infobox/wikis/splatoon/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local Array = require('Module:Array')
local Class = require('Module:Class')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')
local String = require('Module:StringUtils')

local Injector = Lua.import('Module:Widget/Injector')
Expand Down Expand Up @@ -52,12 +51,6 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param lpdbData table
---@param args table
---@return table
Expand All @@ -67,9 +60,4 @@ function CustomLeague:addToLpdb(lpdbData, args)
return lpdbData
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = Logic.readBool(args.publisherpremier) and 'true' or nil
end

return CustomLeague
8 changes: 0 additions & 8 deletions components/infobox/wikis/tetris/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
local Array = require('Module:Array')
local Class = require('Module:Class')
local Game = require('Module:Game')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local String = require('Module:StringUtils')
local Table = require('Module:Table')
Expand Down Expand Up @@ -86,13 +85,6 @@ end
---@param args table
function CustomLeague:customParseArguments(args)
self.data.mode = args.team_number and 'team' or 'individual'
self.data.publishertier = args.publisherpremier
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

return CustomLeague
11 changes: 0 additions & 11 deletions components/infobox/wikis/worldoftanks/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ function CustomLeague.run(frame)
return league:createInfobox()
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = tostring(Logic.readBool(args.publisherpremier))
end

---@param id string
---@param widgets Widget[]
---@return Widget[]
Expand Down Expand Up @@ -77,12 +72,6 @@ function CustomLeague:addToLpdb(lpdbData, args)
return lpdbData
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@return string?
function CustomLeague:_createPatchCell()
local data = self.data
Expand Down
12 changes: 0 additions & 12 deletions components/infobox/wikis/zula/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
local Class = require('Module:Class')
local Game = require('Module:Game')
local Lua = require('Module:Lua')
local Logic = require('Module:Logic')

local Injector = Lua.import('Module:Widget/Injector')
local League = Lua.import('Module:Infobox/League')
Expand Down Expand Up @@ -49,15 +48,4 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@param args table
---@return boolean
function CustomLeague:liquipediaTierHighlighted(args)
return Logic.readBool(args.publisherpremier)
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = tostring(Logic.readBool(args.publisherpremier))
end

return CustomLeague
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
placement.placeStart
)

lpdbData.extradata.publisherpremier = Variables.varDefault('tournament_publisher_major') and 'true' or ''

local team = lpdbData.participant or ''
local lpdbPrefix = placement.parent.options.lpdbPrefix

Expand Down
2 changes: 0 additions & 2 deletions components/prize_pool/wikis/pokemon/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
placement.placeStart
)

lpdbData.extradata.publisherpremier = Variables.varDefault('tournament_publisher_major') and 'true' or ''

local lastVs = ((opponent or {}).additionalData or {}).LASTVS or {}
if lastVs.type == Opponent.solo then
local playerData = (lastVs.players or {})[1] or {}
Expand Down
1 change: 1 addition & 0 deletions spec/prize_pool_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe('prize pool', function()
players = '{"p1":"Rathoz","p1dn":"Rathoz","p1flag":"Sweden"}', -- Legacy
prizemoney = 970.97276906869001323,
prizepoolindex = 1,
publishertier = 'false',
series = 'Test Series',
shortname = 'Test Tourney',
startdate = '2022-10-13',
Expand Down
2 changes: 1 addition & 1 deletion spec/team_card_storage_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Team Card Storage', function()
imagedark = args.imagedark1,
mode = 'team',
participant = 'Team Liquid',
publishertier = nil,
publishertier = 'false',
icon = tournamentData.icon,
icondark = tournamentData.icondark,
game = string.lower(tournamentData.game),
Expand Down

0 comments on commit 6bb9a37

Please sign in to comment.