-
Notifications
You must be signed in to change notification settings - Fork 96
feat(infobox): Add rematch Infobox player #6112
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
base: main
Are you sure you want to change the base?
Conversation
feat(Infobox): add positions parameter for Rematch
|
all requested changes have been applied! |
| ---@param args table | ||
| ---@param birthDisplay string | ||
| ---@param personType string | ||
| ---@param status PlayerStatus | ||
| ---@return string[] | ||
| function CustomPlayer:getCategories(args, birthDisplay, personType, status) | ||
| if not Namespace.isMain() then return {} end | ||
|
|
||
| local categories = {} | ||
| local roles = String.isNotEmpty(args.roles) and Array.parseCommaSeparatedString(args.roles, ',') or {} | ||
|
|
||
| Array.forEach(roles, function(role) | ||
| local roleCategory = role .. 's' | ||
| table.insert(categories, roleCategory) | ||
| end) | ||
|
|
||
| Array.forEach(self:getLocations(), function(country) | ||
| local demonym = Flags.getLocalisation(country) | ||
| if demonym then | ||
| Array.forEach(roles, function(role) | ||
| local roleCategory = demonym .. ' ' .. role .. 's' | ||
| table.insert(categories, roleCategory) | ||
| end) | ||
| end | ||
| end) | ||
|
|
||
| if String.isNotEmpty(args.positions) then | ||
| local positions = Array.parseCommaSeparatedString(args.positions, ',') | ||
| local validPositions = Array.filter(positions, function(pos) | ||
| return String.isNotEmpty(pos) | ||
| end) | ||
| Array.forEach(validPositions, function(pos) | ||
| local category = String.upperCaseFirst(pos) .. 's' | ||
| table.insert(categories, category) | ||
| Array.forEach(self:getLocations(), function(country) | ||
| local demonym = Flags.getLocalisation(country) | ||
| if demonym then | ||
| table.insert(categories, demonym .. ' ' .. category) | ||
| end | ||
| end) | ||
| end) | ||
| end | ||
|
|
||
| return categories | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heavily opposed to this
use CustomPlayer:getWikiCategories(categories) instead to add wiki specific categories!
(although on a new wiki i very highly doubt it is necessary at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the categories for positions with nationality, but I kept the categories for the positions themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which still doesn't catch the biggest issue of the comment
you are overwriting the entire category handling from commons, which is a no-go
|
Use the default roles input over the custom position input |
Co-authored-by: hjpalpha <[email protected]>
that's what I wanted to do at first, but given all the possibilities, I thought it would be good to leave the choice open. |
Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: hjpalpha <[email protected]>
Co-authored-by: hjpalpha <[email protected]>
|
I think the file is ready to be merged, if everyone is okay? |
NO!
|
About positions, I would like to add default ones, the problem is that I don't know all of them because players can be Mid/Mid Offensive/Central Forward and lot more, but if I can suggest something is to let it on custom param from now on, and change it after when we'll have all positions known generally, but if you prefer some ones now, I'll work on it |
|
Any update? |
hjpalpha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as already mentioned before not a fan of the position stuff
and since rath is opposed to it too i deem it unlikely to get approval
| ---@param personType string | ||
| ---@param status PlayerStatus | ||
| ---@return string[] | ||
| function CustomPlayer:getCategories(args, birthDisplay, personType, status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as already mentioned before
do not overwrite the commons function!
if you actually need to append the list of categories with wiki specific ones use CustomPlayer:getWikiCategories(categories) instead!
feat(Infobox): add positions parameter for Rematch
Summary
For the introduction of the Rematch wiki, I modified the Infobox to ensure that players' "positions" can be listed in their Infobox.
How did you test this change?
On my page: https://liquipedia.net/rematch/Eraclesss
Dev: mej