ho-dev / HattrickOrganizer

Assistant for Hattrick online football manager
https://ho-dev.github.io/HattrickOrganizer/
GNU Lesser General Public License v3.0
195 stars 79 forks source link

[BUG] Experience review - including subskill recalculation (7-weeks) #1542

Closed masterpatje closed 1 year ago

masterpatje commented 2 years ago

Describe the bug I took a deep dive into experience and how it is calculated in HO.

Because hattrick has a page where you can see the drilldown in experience points (click on a player and there is a tab "more information" with historic results of a player including minutes played and on which position and experience gained etc. ). You can almost exactly determine the experience sub-level.

In order to correctly interpreted the results could you (@wsbrenk ) answer a few questions:

Findings:

By hand I calculated the experience for 7 a 8 weeks in a row. So hope you can look at this as soon as possible so that I can do proper testing and see how we can improve this part.

To Reproduce Steps to reproduce the behavior:

  1. Download data
  2. Compare data with last week data (look at experience)
  3. Do a subskill recalculation (7-weeks)
  4. Compare data with last week data (look at experience)

Screenshots Experience increase by comparison (after subskill recalculation 7-weeks) image

Matches played between 18th June 2022 10:29 and 24th June 10:57 image

image

Platform information:

Additional context Hattrick change:

wsbrenk commented 2 years ago
select * from spieler 

or

select * from spieler where spielerid=1234566

see example above (29 days ago)

masterpatje commented 2 years ago

Ok I changed the SQL statement to only include the HRF file and the corresponding SUBEXPERIENCE select * from spieler where spieler.datum = '2022-06-11 23:32:08.000000' order by spieler.lastname, DATUM

image

This corresponds to the initial value for the calculation. But that value is actually the summed calculation of ALL the previous HRF files before that. (I haven't checked if the value actually corresponds to the other HRF files in the database).

In fact that means that the calculated experience value is thus not the latest 7 weeks but is always the total experience from the files in the database. Or am I mistaken? (I think this actually is a good thing, because no matter if you take the 7-weeks of full recalculation you always get the total experience for the player. It would not make to much sense to only calculate it for the last 7 weeks.).

masterpatje commented 2 years ago

These are the HRF files in my test database Do you know why the SUBEXPERIENCE in the OLDEST HRF FILE is 0,0 and not equal to the experience from the matches within that training week?

EDIT 23:30: might be do to the fact that I imported this file and because it is outside the 7-weeks recalculation it does not yet have a calculated SUBEXPERIENCE and is thus 0. EDIT 23:54: yes I tested this and it is true that imported files SUBEXPERIENCE stay 0 untill recalculated image

wsbrenk commented 2 years ago

Do you know why the SUBEXPERIENCE in the OLDEST HRF FILE is 0,0 and not equal to the experience from the matches within that training week?

if you recalc only 7 weeks, the hrfs before that won't be changed (remain 0 if never were calculated). if you recalc unlimited they should consider all matches downloaded for the trainings. training has to be set correctly too. if training info of matches are missing the warning should appear in logs.

masterpatje commented 2 years ago

@wsbrenk I figured out what is going on and why I got different outcomes!! Offset in correct calculation occurs only when the calculation coincides with a previous file that holds a lower ERFAHRUNG level. On top of that I had 4 players that leveled in the same week in the 8th week before the calculation. That is why the calculation affected multiple players.

For this I used the following SQL statement: select HRF_ID, DATUM, PLAYERNUMBER, LASTNAME, ERFAHRUNG, SUBEXPERIENCE, LASTMATCHDATE, LASTMATCH_PLAYEDMINUTES from spieler order by HRF_ID, PLAYERNUMBER, DATUM Below a screenshot of the information: image

Now I compared the latest HRF files in the database on ERFAHRUNG and SUBEXPERIENCE 9th (and last) oldest HRF: Season 70 Training Week 8 (base file that was not considered in the recalculation and does not hold SUBEXPERIENCE value that influences the calculation, but still is important because if the value ERFAHRUNG) image 8th oldest HRF: Season 70 Training Week 9 (base file that was not considered in the recalculation, but because it holds the initial value the subexperience was considered and calculated). It is important to note that HO7 notices an increase in ERFAHRUNG of 1 and sets the SUBEXPERIENCE to 0. image 7th oldest HRF: Season 70 Training Week 10 (experience was recalculated) image

In my excel it is not Training Week 9 but Training Week 10 when 4 of my players gain experience. Following the logic of the current calculation the SUBEXPERIENCE should be set to 0 in Week 10 (minimum value after increase of experience).

Alternatively the SUBEXPERIENCE can be set for the matches in Training Week 10 (maximum value). image

image Table below shows that the SUBEXPERIENCE is set to 0 in Training Week 9 (1 week prior to Week 10 that holds the initial value for SUBEXPERIENCE) image

image

It was quite some search, but at least now I know where the calculation starts to differ and why by accident it was affecting 4 players (because in that exact week 4 players increased in experience).

Hopefully by these examples I could explain to you what I found out. Please let me know if something is not clear enough so I can explain better.

masterpatje commented 2 years ago

Today I further thought about the 'cause' that ERFAHRUNHG gain was 1 week early so that we can find a fix.

And I think that it has to do with the following:

In above ecample HO7 resets the SUBEXPERIENCE in S70 W9 instead of S70 W10.

I think the same will occur if I take a (really) old file where ERFAHRUNG is 1 level lower for all (or many) players. Most probably it will trigger the same that for all players the SUBEXPERIENCE is set to 0.

wsbrenk commented 2 years ago

@masterpatje we should split the experience calculation from the skill calculation. skill on training date and experience on match date

masterpatje commented 2 years ago

@masterpatje we should split the experience calculation from the skill calculation. skill on training date and experience on match date

I agree that would be more correct and accurate. Because the information of the player is actual as well on download.

However the advantage of the current calculation is that no duplication can occur due to the fact that training week is leading and thus the SUBEXPERIENCE value of -last- training week is considered the starting value.

So considering 1) that a calculation error for experience might occur if the ERFAHRUNG increased in level (OR the latest file prior to the one holding the initial value of SUBEXPERIENCE has a lower ERFAHRUNG level), 2) When ERFAHRUNG level was increased due to a match that was in the HRF download but follows the training week considered.

what I would propose is the following: (but maybe you have other ideas)

@wsbrenk please share your thoughts on this?

And @wsbrenk is it worth understanding why in certain matches the minutes played was incorrect in HO attribute? I encountered a fee examples and presented them with screenshots above.