foxtrick icon indicating copy to clipboard operation
foxtrick copied to clipboard

[player-stats-experience] XP computation is broken since new Hattrick icons

Open dominiquelee opened this issue 1 year ago • 3 comments

Short description of the problem

XP data fails to load when opening a player's performance history image

Any other relevant information. Is it a regression, when it worked/broke etc.

Match type recognition comes from https://github.com/minj/foxtrick/blob/3780cd4dbfca20ba14997bbba6cf58456d2939ce/content/information-aggregation/player-stats-experience.js#L219-L223 which reads the class name of the icon of the line.

This value is then compared to module.XP: https://github.com/minj/foxtrick/blob/3780cd4dbfca20ba14997bbba6cf58456d2939ce/content/information-aggregation/player-stats-experience.js#L46-L52

However, the class name has changed and is now always match-type-svg image

A potential fix would be to extract the .svg URL, remove the version part and use that as a new key in the array. Some examples of value are

  • /Img/Svgs/match-types/series.svg?v=1
  • /Img/Svgs/match-types/cup.svg?v=1
  • /Img/Svgs/match-types/friendly.svg?v=1
  • /Img/Svgs/match-types/challenger-cup-2.svg?v=1 (Ruby Cup)
  • /Img/Svgs/match-types/nt-worldcup.svg?v=1 (World Cup)
  • /Img/Svgs/match-types/nt-cup-europe.svg?v=1 (Europe Cup)
  • /Img/Svgs/match-types/masters.svg?v=1

dominiquelee avatar Feb 21 '24 15:02 dominiquelee