Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable headtohead storage and wiki variable on dota2 #5212

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
--

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

Expand Down Expand Up @@ -38,6 +39,12 @@ function CustomHiddenDataBox.addCustomVariables(args, queryResult)
Variables.varDefine('tournament_icon_dark', Variables.varDefault('tournament_icondark'))
Variables.varDefine('tournament_parent_page', Variables.varDefault('tournament_parent'))

Variables.varDefine('headtohead', tostring(Logic.readBool(Logic.emptyOr(
args.headtohead,
Variables.varDefault('headtohead'),
(queryResult.extradata or {}).headtohead
))))

BasicHiddenDataBox.checkAndAssign('tournament_patch', args.patch, queryResult.patch)
end

Expand Down
4 changes: 4 additions & 0 deletions components/infobox/wikis/dota2/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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 Variables = require('Module:Variables')
Expand Down Expand Up @@ -86,18 +87,21 @@ end
function CustomLeague:addToLpdb(lpdbData, args)
lpdbData.extradata.individual = String.isNotEmpty(args.player_number) and 'true' or ''
lpdbData.extradata.dpcpoints = String.isNotEmpty(args.points) or ''
lpdbData.extradata.headtohead = self.data.headtohead

return lpdbData
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = (self.publisherTier or {}).name
self.data.headtohead = tostring(Logic.readBool(args.headtohead))
end

---@param args table
function CustomLeague:defineCustomPageVariables(args)
-- Custom Vars
Variables.varDefine('headtohead', self.data.headtohead)
Variables.varDefine('tournament_pro_circuit_points', args.points or '')
local isIndividual = String.isNotEmpty(args.individual) or String.isNotEmpty(args.player_number)
Variables.varDefine('tournament_individual', isIndividual and 'true' or '')
Expand Down
Loading