ShioR / EVE-Character-Showroom

An EVE Online API based web app that shows users their characters skill and the ships they can fly. This is the open source core for evesp.com and the now-offline eve-sheet.com.
https://evecs.evesp.com
GNU General Public License v3.0
11 stars 3 forks source link

Current skill in training SP Trained/Percentage wrong, time left correct #83

Closed MrBMT closed 8 years ago

MrBMT commented 8 years ago

As per the title, the time remaining is correct, as is the SP/hour. However the percentage trained and progress is off.

Any ideas what might be causing this?

Image showing error

ShioR commented 8 years ago

I can have a pretty good guess ;)

The percentage in evemon is based on the SP for the skill level, whereas I modified the existing percentage calculations already in the code, which did it for the total SP of the skill (all 5 levels).

I should be able to devote a bit of time towards this again on Friday and I can certainly look at the way this is done if you prefer the way evemon does things?

Other things on the agenda include counters for the total SP figures on the site and a tidy up of date formats, but I need to move the calculations into the skillsheet.php file instead of the template first (too much duplication for my liking)

MrBMT commented 8 years ago

Ah yes, I clearly haven't had enough coffee today!

Now you've explained the percentage there that makes sense (and I should have been able to work that out myself if I wasn't so tired) - up to you if you want to change that to work like EVEMon or not, whichever makes more sense to you really.

It would be fantastic if that SP trained part could be looked into, as I noticed earlier one of my toons said it had negative SP Remaining (e.g. something like 65,000 of 64,000 / -1,000 SP Remaining) for a skill that was still actually being trained, and as you can see in that screenshot I had a little under 122k SP trained for Drone Sharpshooting that skill, but ECS was saying I had a little under 124k trained instead.

Nice, that all sounds good to me, cheers!

ShioR commented 8 years ago

To be fair, it does say "Progress", so I probably should change it to the level being trained rather than the skill. Something like this for the main skill info and just percentage of the level up the top. qKY.png

I did notice the site was showing 2100 SP difference to that of evemon, in my testing with evemon it was only showing ~2-3 SP so that probably needs to be looked at as well.

Regarding the negative SP remaining, the only way I can see that happening is if the character had just finished training a skill and the API hadn't updated yet to show the new skill was being trained, was this the case? If not I'll have a dig around.

PS. I need to say a massive thank you for the input you've been putting into this and everything else, it's nice to actually know someone is looking at this apart from me. 💖

ShioR commented 8 years ago

Had a look at the EVEMon source today, particularly the percentages for currently training skill, here and done the same calculations manually but cannot get the same percentage as the app is outputting, I'm actually getting very close to my numbers. (Which upon further investigation does show the percentage of the level being trained and not that of the whole skill.)

So, either I'm doing something wrong, or there is more to it.

To clarify my calculations, I'm doing $spProgress / $trainingEndSP * 100, for example 868133 / 2048000 * 100 which is 42.3893% (I round to one decimal place)

$spProgress is the calculation of the SP of the skill when it started being trained (Not always at the level breaks, can be different since it gets updated when skill queue is paused, restarted and saved in game) and the calculation of seconds passed since then converted into hours, then converted to SP using the SP/hour number.

$trainingEndSP is the SP number the training for the skill is 'expected' to end on, for example when the level completes.

I've reached out to the EVEMon team to clarify the way in which they calculate the percentage.

MrBMT commented 8 years ago

Hey,

To be fair, it does say "Progress", so I probably should change it to the level being trained rather than the skill. Something like this for the main skill info and just percentage of the level up the top.

Looks good to me!

Regarding the negative SP remaining, the only way I can see that happening is if the character had just finished training a skill and the API hadn't updated yet to show the new skill was being trained, was this the case? If not I'll have a dig around.

That's not the case for me, I've had the same thing happen again on a different toon this evening and took a screenshot this time round for you (I thought I had the last time, but couldn't find it).

Image showing issue

As you can see, I'm training Energy Pulse Weapons to Level 3, I have 15,012 SP of 16,000 SP trained (confirmed both in-game skill queue and via EVEMon).

In-game skill queue, EVEMon and ECS all agree there's roughly 26 minutes left to train.

However for some reason ECS somehow thinks I've trained 17,292 SP and therefore have negative 1,292 SP remaining, based on what you've said this tends to suggest $spProgress is somehow being set to the wrong number?

Thanks for all the time you put in to maintaining this. I for one really appreciate it, I've been meaning to look into it more but haven't had the chance lately... hopefully soon!

Cheers!

ShioR commented 8 years ago

Thanks for the screenshot, it could be a case of the timezone issue I thought would crop up with daylight savings - https://github.com/ShioR/EVE-Character-Showroom/commit/387e3e5ace5fc93726adb37160339dad069b40c6#commitcomment-18556191 It takes the timestamp of the server and takes 1 hour off. In my case, converting BST back into GMT+0 (UTC).

I added it because I'm pretty certain that setting the timezone in htaccess in the way I have doesn't actually work anymore. Yet another reason to move the calculations for all of this into skillsheet.php rather than the templates, not that I have much idea how the original author accounted for the timezone differences anyway.

Thanks for the kind words and good luck when you go diving in! (I was a fan of the nginx friendly version you had 😉)

Edit: After having a think about this some more, surely if the timezone was wrong, the SP count would always been wrong when compared to that of EVEMon and in-game. I'm back to having no idea again -_-

MrBMT commented 8 years ago

Thanks for mentioning that! You set me on the right path and through a little experimentation I've managed to get the correct progress SP now, I think previously I must just not have noticed it was incorrect because I assumed everything was okay with the time remaining being correct.

So I've got a bit of a weird setup for ECS right now, I don't have Apache on my server but managed to come up with a fully working Nginx config - the last one I had up on Github wasn't quite right from what I remember. If you're interested in it I can chuck the new Nginx config in a config folder and submit a pull request?

Because Nginx doesn't support .htaccess files I've been setting the timezone via the config file with: date_default_timezone_set('Timezone Reference goes here')

However I've got a bit of a weird situation with my server - the server timezone is set to UK time (so currently BST) because that's where I lived and various services I'm running depend on using the UK timezone (e.g. email etc) because I run stuff on it for a bunch of people in the UK.

Despite that I'm currently living in France, and to get the correct Time remaining to show for whatever reason I had to set the config timezone to Europe/Paris - setting it to Atlantic/Reykjavik gave the wrong time remaining.

Anyway, what fixed it for me was the end was changing the y in the equation you mentioned from 3600 to 7200.

<!--[math equation="x - y" x=$smarty.now y=7200 assign='secondsTrainedEVE']-->

ShioR commented 8 years ago

This is obviously going to be problematic for the future, looks like I'll need to do this in a better way since I don't want to change the value twice a year so I doubt anyone else wants to! Perhaps I could do some sort of calculation against $smarty.now (local epoch) and UTC epoc and use that in a variable for the y=3600

Any sign of the negative SP issue since?

Still nothing from the EVEMon team regarding their percentage calculations, I do hope they actually monitor the email address they list..

I've got two or three things on the list for today and hopefully I'll still have time for the things mentioned here and then I can finally bump the version number to 6, lol.

The nginx config was more of a personal interest, I wouldn't be able to run it myself, stuck with Apache and Varnish due to customers, one day I'll be able to run nginx though. :)

Edit: 5/6 things on the list done, next up is all the things mentioned here and testing that I've not already dealt with, should get finished today.

MrBMT commented 8 years ago

Perhaps I could do some sort of calculation against $smarty.now (local epoch) and UTC epoc and use that in a variable for the y=3600

Right, that sounds like a very sensible way of doing things!

Any sign of the negative SP issue since?

Nope, all seems to be good now! Time remaining and SP progress are both correct now (instead of just time remaining being correct before changing the y) and I've verified that it's working correctly on multiple toons.

Cheers

ShioR commented 8 years ago

Good news then!

I've set the timezone in skillsheet.php now instead of htaccess and everything appears to be working ok regarding SP progress and time remaining. I'm crossing my fingers that this still works OK when it reaches you along with a load of other things. :)

ShioR commented 8 years ago

All the issues mentioned here should be fixed as of version 6, I've put it through a fair bit of testing but I can't recreate every use case.

Going to go ahead and mark this as resolved now