Skip to content

Conversation

@ElectricalBoy
Copy link
Collaborator

Summary

This PR adds Module:PlayerTournamentAppearances to this repository.

How did you test this change?

preview with dev

Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i assume correctly that the args are named as they are for them being already used?
(they do not follow a scheme, some all lower, some snake case etc pp)

Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should likely use widgets instead of mw.html stuff (e.g. in row function)

@ElectricalBoy
Copy link
Collaborator Author

do i assume correctly that the args are named as they are for them being already used?

yes, see ca001ac...8c5104f

Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shit to check on phone hence just the question
do we display the link to query form even if it comed from query?

@ElectricalBoy
Copy link
Collaborator Author

do we display the link to query form even if it comed from query?

short answer: no

form silently passes query=true to args which is then parsed & stored in self.config

self.config = {
showPlacementInsteadOfTeam = Logic.readBool(args.showPlacementInsteadOfTeam),
limit = tonumber(args.limit),
isFormQuery = Logic.readBool(args.query),
restrictToPlayersParticipatingIn = args.playerspage,
restrictToFirstPrizePool = Logic.readBool(args.restrictToFirstPrizePool),
}

@ElectricalBoy
Copy link
Collaborator Author

should likely use widgets instead of mw.html stuff (e.g. in row function)

actually the row function is the only remaining use of mw.html in the new version

if self.config.showPlacementInsteadOfTeam then
-- Default to empty string to use data-sort-value
Placement._placement{parent = cell, placement = (result or {}).placement or ''}

and we actually need mw.html there until we refactor Placement._placement

---Takes parent mw html object and childs a placement.
---Expected args fields are `parent` and `placement`.
---@param args {placement: string|integer?, parent: Html, text: string?}
function Placement._placement(args)
if not (type(args) == 'table' and type(args.parent) == 'table') then
return
end
local raw = Placement.raw(args.placement or '')
args.parent:css('text-align', 'center')
:attr('data-sort-value', raw.sort)
:addClass(raw.backgroundClass)
:tag('b')
:addClass(not raw.blackText and 'placement-text' or nil)
:wikitext(raw.display .. (Logic.isNotEmpty(args.text) and (' ' .. args.text) or ''))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants