From b867a31ac6791d6579f700afaeaf0cb816ff0db8 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sun, 13 Oct 2024 15:00:34 +0200 Subject: [PATCH 1/4] feat(several): switch from female to game changer on valorant --- .../wikis/valorant/hidden_data_box_custom.lua | 3 ++- .../infobox/wikis/valorant/infobox_league_custom.lua | 10 ++++++---- components/match2/wikis/valorant/match_legacy.lua | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua index cfd7f2cc67f..46143f68d99 100644 --- a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua +++ b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua @@ -7,6 +7,7 @@ -- local Class = require('Module:Class') +local Logic = require('Module:Logic') local Lua = require('Module:Lua') local Tier = require('Module:Tier/Custom') local Variables = require('Module:Variables') @@ -39,7 +40,7 @@ function CustomHiddenDataBox.addCustomVariables(args, queryResult) Variables.varDefine('tournament_ticker_name', Variables.varDefault('tournament_tickername')) Variables.varDefine('tournament_icon_darkmode', Variables.varDefault('tournament_icondark')) Variables.varDefine('mode', Variables.varDefault('tournament_mode', 'team')) - Variables.varDefine('female', queryResult.extradata.female or args.female and 'true' or 'false') + Variables.varDefine('gamechanger', queryResult.extradata.gamechanger or tostring(Logic.readBool(args.gc or args.female))) BasicHiddenDataBox.checkAndAssign('patch', args.patch, queryResult.patch) BasicHiddenDataBox.checkAndAssign('tournament_riot_premier', queryResult.tournament_riot_premier, args.riotpremier) end diff --git a/components/infobox/wikis/valorant/infobox_league_custom.lua b/components/infobox/wikis/valorant/infobox_league_custom.lua index 799666fe963..f463a1f9b50 100644 --- a/components/infobox/wikis/valorant/infobox_league_custom.lua +++ b/components/infobox/wikis/valorant/infobox_league_custom.lua @@ -44,6 +44,8 @@ end ---@param args table function CustomLeague:customParseArguments(args) self.data.mode = (args.individual or args.player_number) and '1v1' or 'team' + -- female as a temp alias to bot the old input over + self.data.gameChanger = Logic.readBool(args.gc or args.female) self.data.publishertier = Logic.readBool(args['riot-highlighted']) and 'highlighted' or Logic.readBool(args['riot-sponsored']) and 'sponsored' or nil @@ -89,8 +91,8 @@ end function CustomLeague:getWikiCategories(args) local categories = {} - if Logic.readBool(args.female) then - table.insert(categories, 'Female Tournaments') + if self.data.gameChanger then + table.insert(categories, 'Game Changers Tournaments') end return categories @@ -105,7 +107,7 @@ function CustomLeague:addToLpdb(lpdbData, args) lpdbData.extradata.region = Template.safeExpand(mw.getCurrentFrame(), 'Template:Player region', {args.country}) lpdbData.extradata.startdate_raw = args.sdate or args.date lpdbData.extradata.enddate_raw = args.edate or args.date - lpdbData.extradata.female = args.female or 'false' + lpdbData.extradata.gamechangers = tostring(self.data.gameChanger) return lpdbData end @@ -146,7 +148,7 @@ end ---@param args table function CustomLeague:defineCustomPageVariables(args) -- Wiki Custom - Variables.varDefine('female', args.female or 'false') + Variables.varDefine('gamechanger', tostring(self.data.gameChanger)) Variables.varDefine('tournament_riot_premier', args.riotpremier and 'true' or '') Variables.varDefine('patch', args.patch or '') diff --git a/components/match2/wikis/valorant/match_legacy.lua b/components/match2/wikis/valorant/match_legacy.lua index d12d1abe916..206c2de11bb 100644 --- a/components/match2/wikis/valorant/match_legacy.lua +++ b/components/match2/wikis/valorant/match_legacy.lua @@ -136,7 +136,7 @@ function MatchLegacy._convertParameters(match2) local extradata = Json.parseIfString(match2.extradata) match.extradata.matchsection = extradata.matchsection - match.extradata.female = Variables.varDefault('female') + match.extradata.gamechanger = Variables.varDefault('gamechanger') match.extradata.hidden = Logic.readBool(Variables.varDefault('match_hidden')) and '1' or '0' match.extradata.cancelled = Logic.readBool(Variables.varDefault('cancelled')) and '1' or '0' match.extradata.bestofx = match2.bestof ~= 0 and tostring(match2.bestof) or '' From 3f9b9070545bacef857326e151ce9a0fc4c42fdf Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sun, 13 Oct 2024 15:06:09 +0200 Subject: [PATCH 2/4] break line due to length --- .../hidden_data_box/wikis/valorant/hidden_data_box_custom.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua index 46143f68d99..f01458d0d75 100644 --- a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua +++ b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua @@ -40,7 +40,8 @@ function CustomHiddenDataBox.addCustomVariables(args, queryResult) Variables.varDefine('tournament_ticker_name', Variables.varDefault('tournament_tickername')) Variables.varDefine('tournament_icon_darkmode', Variables.varDefault('tournament_icondark')) Variables.varDefine('mode', Variables.varDefault('tournament_mode', 'team')) - Variables.varDefine('gamechanger', queryResult.extradata.gamechanger or tostring(Logic.readBool(args.gc or args.female))) + Variables.varDefine('gamechanger', queryResult.extradata.gamechanger + or tostring(Logic.readBool(args.gc or args.female))) BasicHiddenDataBox.checkAndAssign('patch', args.patch, queryResult.patch) BasicHiddenDataBox.checkAndAssign('tournament_riot_premier', queryResult.tournament_riot_premier, args.riotpremier) end From a5a1e810928ccb83028b08c4ec1b3da87499a106 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Sun, 13 Oct 2024 16:49:40 +0200 Subject: [PATCH 3/4] Apply suggestions from code review --- components/infobox/wikis/valorant/infobox_league_custom.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/infobox/wikis/valorant/infobox_league_custom.lua b/components/infobox/wikis/valorant/infobox_league_custom.lua index f463a1f9b50..f0ba6005a60 100644 --- a/components/infobox/wikis/valorant/infobox_league_custom.lua +++ b/components/infobox/wikis/valorant/infobox_league_custom.lua @@ -92,7 +92,7 @@ function CustomLeague:getWikiCategories(args) local categories = {} if self.data.gameChanger then - table.insert(categories, 'Game Changers Tournaments') + table.insert(categories, 'Game Changer Tournaments') end return categories @@ -107,7 +107,7 @@ function CustomLeague:addToLpdb(lpdbData, args) lpdbData.extradata.region = Template.safeExpand(mw.getCurrentFrame(), 'Template:Player region', {args.country}) lpdbData.extradata.startdate_raw = args.sdate or args.date lpdbData.extradata.enddate_raw = args.edate or args.date - lpdbData.extradata.gamechangers = tostring(self.data.gameChanger) + lpdbData.extradata.gamechanger = tostring(self.data.gameChanger) return lpdbData end From 0d7dd200be78ef2c1c4edd08e722e87085e49699 Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Mon, 11 Nov 2024 11:56:23 +0100 Subject: [PATCH 4/4] as per review --- .../wikis/valorant/hidden_data_box_custom.lua | 2 +- .../infobox/wikis/valorant/infobox_league_custom.lua | 10 +++++----- components/match2/wikis/valorant/match_legacy.lua | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua index f01458d0d75..a603747a4f2 100644 --- a/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua +++ b/components/hidden_data_box/wikis/valorant/hidden_data_box_custom.lua @@ -40,7 +40,7 @@ function CustomHiddenDataBox.addCustomVariables(args, queryResult) Variables.varDefine('tournament_ticker_name', Variables.varDefault('tournament_tickername')) Variables.varDefine('tournament_icon_darkmode', Variables.varDefault('tournament_icondark')) Variables.varDefine('mode', Variables.varDefault('tournament_mode', 'team')) - Variables.varDefine('gamechanger', queryResult.extradata.gamechanger + Variables.varDefine('gamechangers', queryResult.extradata.gamechangers or tostring(Logic.readBool(args.gc or args.female))) BasicHiddenDataBox.checkAndAssign('patch', args.patch, queryResult.patch) BasicHiddenDataBox.checkAndAssign('tournament_riot_premier', queryResult.tournament_riot_premier, args.riotpremier) diff --git a/components/infobox/wikis/valorant/infobox_league_custom.lua b/components/infobox/wikis/valorant/infobox_league_custom.lua index f0ba6005a60..eb975795351 100644 --- a/components/infobox/wikis/valorant/infobox_league_custom.lua +++ b/components/infobox/wikis/valorant/infobox_league_custom.lua @@ -45,7 +45,7 @@ end function CustomLeague:customParseArguments(args) self.data.mode = (args.individual or args.player_number) and '1v1' or 'team' -- female as a temp alias to bot the old input over - self.data.gameChanger = Logic.readBool(args.gc or args.female) + self.data.gameChangers = Logic.readBool(args.gc or args.female) self.data.publishertier = Logic.readBool(args['riot-highlighted']) and 'highlighted' or Logic.readBool(args['riot-sponsored']) and 'sponsored' or nil @@ -91,8 +91,8 @@ end function CustomLeague:getWikiCategories(args) local categories = {} - if self.data.gameChanger then - table.insert(categories, 'Game Changer Tournaments') + if self.data.gameChangers then + table.insert(categories, 'Game Changers Tournaments') end return categories @@ -107,7 +107,7 @@ function CustomLeague:addToLpdb(lpdbData, args) lpdbData.extradata.region = Template.safeExpand(mw.getCurrentFrame(), 'Template:Player region', {args.country}) lpdbData.extradata.startdate_raw = args.sdate or args.date lpdbData.extradata.enddate_raw = args.edate or args.date - lpdbData.extradata.gamechanger = tostring(self.data.gameChanger) + lpdbData.extradata.gamechangers = tostring(self.data.gameChangers) return lpdbData end @@ -148,7 +148,7 @@ end ---@param args table function CustomLeague:defineCustomPageVariables(args) -- Wiki Custom - Variables.varDefine('gamechanger', tostring(self.data.gameChanger)) + Variables.varDefine('gamechangers', tostring(self.data.gameChangers)) Variables.varDefine('tournament_riot_premier', args.riotpremier and 'true' or '') Variables.varDefine('patch', args.patch or '') diff --git a/components/match2/wikis/valorant/match_legacy.lua b/components/match2/wikis/valorant/match_legacy.lua index 206c2de11bb..5e36dee22e3 100644 --- a/components/match2/wikis/valorant/match_legacy.lua +++ b/components/match2/wikis/valorant/match_legacy.lua @@ -136,7 +136,7 @@ function MatchLegacy._convertParameters(match2) local extradata = Json.parseIfString(match2.extradata) match.extradata.matchsection = extradata.matchsection - match.extradata.gamechanger = Variables.varDefault('gamechanger') + match.extradata.gamechangers = Variables.varDefault('gamechangers') match.extradata.hidden = Logic.readBool(Variables.varDefault('match_hidden')) and '1' or '0' match.extradata.cancelled = Logic.readBool(Variables.varDefault('cancelled')) and '1' or '0' match.extradata.bestofx = match2.bestof ~= 0 and tostring(match2.bestof) or ''