Skip to content
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

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

Open
dominiquelee opened this issue Feb 21, 2024 · 3 comments

Comments

@dominiquelee
Copy link
Contributor

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

var getBasicGameType = function(node) {
var gametypeParent = node.querySelector('td.keyColumn');
var gameTypeImage = gametypeParent.querySelector('.iconMatchtype img');
return /** @type {MatchTypeClassRaw} */ (gameTypeImage.className);
};

which reads the class name of the icon of the line.

This value is then compared to module.XP:

XP: {
// assume international friendly as default, considered in min-max,
// minimum uses 1/2 of this value
matchFriendly: 0.7,
matchLeague: 3.5,
matchCupA: 7.0,
matchCupB1: 1.75,

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
Copy link
Contributor Author

I had another look, thinking we could use a simple Image --> MatchTypeClass mapping, but it's actually not that easy:

  • NT friendly uses the same image as regular friendly
  • NT KO uses the same image as NT not-KO
  • continental cups use different images, but that's probably ok
  • Africa's NT and U21 images are reversed, so we definitely need to drop the version when parsing

@SebM668
Copy link

SebM668 commented Jul 3, 2024

@dominiquelee
I sent a message to the CHPP staff, asking if this is how it will be going forward and if they have any suggestions. Worst case they'll tell me to go away, best case...

@SebM668
Copy link

SebM668 commented Jul 5, 2024

@dominiquelee I sent a message to the CHPP staff, asking if this is how it will be going forward and if they have any suggestions. Worst case they'll tell me to go away, best case...

What a waste of time that was. Basically, we do what we want, deal with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants