Skip to content

feat: Add DurationStats module to the GitHub - #8242

Open
steve020607 wants to merge 10 commits into
mainfrom
steve020607-patch-3
Open

steve020607 wants to merge 10 commits into
mainfrom
steve020607-patch-3

Conversation

@steve020607

@steve020607 steve020607 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This module is used to display the Longest and the Shortest game, based on match2 LPDB
The module also created by Freg(on honorofkings wiki)

for the future: if this code clean enough, it can be moved to commons and used by all other wiki

How did you test this change?

live on the wiki
and after code reworked, it's test with dev

@steve020607
steve020607 requested review from a team as code owners October 17, 2026 14:30
@steve020607 steve020607 added g: mobilelegends Mobile Legends: Bang Bang c: statistics labels Oct 17, 2026

@hjpalpha hjpalpha left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

imo clean up and refactor to feature structure on commons

if you need help lmk

Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
Comment thread lua/wikis/mobilelegends/DurationStats.lua Outdated
@steve020607
steve020607 requested a review from hjpalpha October 18, 2026 08:43
@steve020607

Copy link
Copy Markdown
Collaborator Author

tested and works fine
https://liquipedia.net/mobilelegends/User:Steve23/Testing_Page

probably can make it to an args to show the Shortest only or Longest only

@fregerson

fregerson commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This module is used to display the Longest and the Shortest game, based on match2 LPDB The module also created by Piratz

Fwiw I was the original creator of the module, later ported over to ML wiki.

Haven't had time to look at it through again, but I didn't port it to Github because there was a few features that were requested and on my TODO:

  • Dealing with a lack of matchsection. It could also be a source problem, my original intention was using matchsection but I do realise that especially for bracket stages, it is more likely that the subheader is something else. Example here, it currently shows as dash, but ideally Stage could be something more reflective, such as the match header. Alternative would be to hide the column when these are all dashes like in the example.
  • Ability to show average time. The module came through as a request from some viewers, they were wondering if we can produce a table that can show some duration statistics. Since my original implementation was rather haphazard (for example dealing with duration as a string not as numbers) that wasn't possible, but I hoped to be able to showcase that as well.
  • Option to showcase link to VOD.

@steve020607

steve020607 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Summary

This module is used to display the Longest and the Shortest game, based on match2 LPDB The module also created by Piratz

Fwiw I was the original creator of the module, later ported over to ML wiki.

ough i guess it's on another wiki copy paste, my bad.
Will see if i will need some adjustments or not based on the module

Edit: Not Much diffirent

@steve020607

Copy link
Copy Markdown
Collaborator Author
  • Dealing with a lack of matchsection. It could also be a source problem, my original intention was using matchsection but I do realise that especially for bracket stages, it is more likely that the subheader is something else. Example here, it currently shows as dash, but ideally Stage could be something more reflective, such as the match header. Alternative would be to hide the column when these are all dashes like in the example.

why not just use the 'Results' if there's no match.extradata.section?
since it will automatically link to the page

  • Ability to show average time. The module came through as a request from some viewers, they were wondering if we can produce a table that can show some duration statistics. Since my original implementation was rather haphazard (for example dealing with duration as a string not as numbers) that wasn't possible, but I hoped to be able to showcase that as well.

so liked average time of all of the matches? or per section(the Longest and the Shortest have their own average time)

  • Option to showcase link to VOD.
    there's an lpdb for the vod, but idk how to show the icon though....

@fregerson

fregerson commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator
  • Dealing with a lack of matchsection. It could also be a source problem, my original intention was using matchsection but I do realise that especially for bracket stages, it is more likely that the subheader is something else. Example here, it currently shows as dash, but ideally Stage could be something more reflective, such as the match header. Alternative would be to hide the column when these are all dashes like in the example.

why not just use the 'Results' if there's no match.extradata.section? since it will automatically link to the page

Also works, but I removed it later due to it looking a bit strange (especially for double elimination, which result is result?)

  • Ability to show average time. The module came through as a request from some viewers, they were wondering if we can produce a table that can show some duration statistics. Since my original implementation was rather haphazard (for example dealing with duration as a string not as numbers) that wasn't possible, but I hoped to be able to showcase that as well.

so liked average time of all of the matches? or per section(the Longest and the Shortest have their own average time)

Ideally of all matches

  • Option to showcase link to VOD.
    there's an lpdb for the vod, but idk how to show the icon though....

Someone should correct me if there is a module for it, but I see in other game history Module code they use something like
row:tag('td'):wikitext(item.vod ~= '' and '[[File:VOD Icon.png|16px|link=' .. item.vod .. '|class=show-when-light-mode|Watch VOD]][[File:VOD Icon darkmode.png|16px|link=' .. item.vod .. '|class=show-when-dark-mode|Watch VOD]]' or tournamentInfo.vod and tournamentInfo.vod ~= '' and '[[File:VOD Icon.png|16px|link=' .. tournamentInfo.vod .. '|class=show-when-light-mode|Watch VOD]][[File:VOD Icon darkmode.png|16px|link=' .. tournamentInfo.vod .. '|class=show-when-dark-mode|Watch VOD]]' or '')

@steve020607

steve020607 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator Author
  • Dealing with a lack of matchsection. It could also be a source problem, my original intention was using matchsection but I do realise that especially for bracket stages, it is more likely that the subheader is something else. Example here, it currently shows as dash, but ideally Stage could be something more reflective, such as the match header. Alternative would be to hide the column when these are all dashes like in the example.

why not just use the 'Results' if there's no match.extradata.section? since it will automatically link to the page
Also works, but I removed it later due to it looking a bit strange (especially for double elimination, which result is result?)

so the current pr is good already, default if no match.extradata.section is 'Results'

  • Ability to show average time. The module came through as a request from some viewers, they were wondering if we can produce a table that can show some duration statistics. Since my original implementation was rather haphazard (for example dealing with duration as a string not as numbers) that wasn't possible, but I hoped to be able to showcase that as well.

so liked average time of all of the matches? or per section(the Longest and the Shortest have their own average time)

Ideally of all matches

quite thinking how can we put it? create another table?

  • Option to showcase link to VOD.

there's an lpdb for the vod, but idk how to show the icon though....

Someone should correct me if there is a module for it, but I see in other game history Module code they use something like
row:tag('td'):wikitext(item.vod ~= '' and '[[File:VOD Icon.png|16px|link=' .. item.vod .. '|class=show-when-light-mode|Watch VOD]][[File:VOD Icon darkmode.png|16px|link=' .. item.vod .. '|class=show-when-dark-mode|Watch VOD]]' or tournamentInfo.vod and tournamentInfo.vod ~= '' and '[[File:VOD Icon.png|16px|link=' .. tournamentInfo.vod .. '|class=show-when-light-mode|Watch VOD]][[File:VOD Icon darkmode.png|16px|link=' .. tournamentInfo.vod .. '|class=show-when-dark-mode|Watch VOD]]' or '')

that could work, probably need a reworked for the code

also put a space after the >>, if not it will blend with the top

@fregerson fregerson added the g: honorofkings Honor of Kings / Arena of Valor label Oct 18, 2026
@steve020607 steve020607 removed g: mobilelegends Mobile Legends: Bang Bang g: honorofkings Honor of Kings / Arena of Valor labels Oct 18, 2026
---@param order string
---@return match2game[]
function Games.fetch(conditions, limit, order)
return mw.ext.LiquipediaDB.lpdb('match2game', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could potentially use Lpdb.executeMassQuery

args.edate and ConditionNode(ColumnName('date'), Comparator.le, args.edate) or nil
))

local matches = mw.ext.LiquipediaDB.lpdb('match2', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

possibly Lpdb.executeMassQuery

local Logic = Lua.import('Module:Logic')
local OpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')

local Util = Lua.import('Module:Features/DurationStats/Lib/Util')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

components should not import lib modules
rather import them in controller and pass the necessary function from controller to the function that gets called from here
or do the necessary call in controller and pass the result to the component


---@param match MatchGroupUtilMatch?
---@return string
function Util.getStageName(match)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not use the same logic as match ticker does?

@steve020607 steve020607 Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Is there a function that we can use for that? Cannot see it on lua/wikis/commons/MatchTicker/Controller.lua

Edit: the Claude said
"The ticker's logic isn't in MatchTicker/Controller.lua, it's in Widget/Match/Card.lua (_renderStageName): DisplayHelper.expandHeader(match.bracketData.inheritedHeader)[1], falling back to match.section. I now do the same in Lib/Util.getStageName (keeping the matchsection fallback for matches without an inherited header)."

Is it correct?

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.

3 participants