Skip to content

Commit

Permalink
feat: enable headtohead storage and wiki variable on dota2 (#5212)
Browse files Browse the repository at this point in the history
feat(infobox, HDB): enable headtohead storage and wiki variable
  • Loading branch information
hjpalpha authored Dec 16, 2024
1 parent d5988ea commit f23dc1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit f23dc1c

Please sign in to comment.