mauserrifle / simresults

Sim racing result reader for PHP
http://simresults.net
ISC License
60 stars 21 forks source link

Automobilista 2 results - sporadic return of steamid #75

Closed FxUK closed 3 years ago

FxUK commented 3 years ago

First off, thanks for a fantastic tool, I am currently using it to pre-parse results and store in a database.

However, when calling the following for AMS2 result files; foreach($participants as $participant) { ..... $participant->getDriver()->getDriverid() ; ..... }

It seems to only return one or two id's for the entire grid.

i.e Driver 1: Name: A, steamid: Driver 2: Name: B, steamid: Driver 3: Name: C, steamid: Driver 3: Name: D, steamid: 567891321213 Driver 4: Name: E, steamid: 1234512121212

It appears to work ok for other sim result files.

I attempted to dig in, seeing the id's exist in history_data[x]['members'][ {refid} ]['steamid'] but so far have had no joy, so thought I would mention it.

Edit: This appears where there are multiple sessions and a participant has left the server between these sessions and rejoined, so has been given a new refid (I think)

mauserrifle commented 3 years ago

Hi FxUK,

Glad you like the tool! i will look into it. Could you also mail me the log files? This way it's much easier for me to debug if I cannot reproduce with my current test logs. Thanks!

mauserrifle commented 3 years ago

I think I found the problem and fixed it in de7811c0ac4eb0f175af284f04fee91d08d860a7. The steam id is missing for some sessions. Since the participantId and refId change during sessions, there's only one way to fix this issue: remembering the steam ids using driver name as a reference. This is not a perfect solution since it might be bugged when an other driver with the same name joins the server. Anyway this is acceptable for this small bug.

Please test :)

FxUK commented 3 years ago

Hi Mauserrifle

I will send you the log over anyway, but that sounds about right and given the way it logs the info, you can only do what you can do :) To be honest, a name match is what I was looking at too, but I'm still poking around getting used to things so didn't have the expertise to find a solution. For our needs it will be fine, we don't have drivers with the same names or do results for public servers.

Thank you so much, will test and let you know.

mauserrifle commented 3 years ago

I have issues with the log you sent me. So I am still on this.

mauserrifle commented 3 years ago

I checked all drivers that were missing a steamid in your log results and I cannot find any steamid for them by eye in the json. So they seem to be really missing. Please let me know if I am wrong. Maybe it's a privacy setting in ACC/Steam?

FxUK commented 3 years ago

Hi, sorry it took me a while to get around to trying this. It's a bit of a strange one... I am working around it my end with matching existing members to the results by name.

However, from a few I have checked, the steam id's exist in the json, but seem completely detached i.e using myself as an example, 76561197992795567 doesn't appear to be listed where you would expect under history... However, under players it exists, with the steam ID being the key and containing a name: field matching the name used elsewhere.

Anyway, its not major.. bad data is bad :)

mauserrifle commented 3 years ago

Awsome. I missed that array. Thanks for pointing that out. I fixed it! Commit https://github.com/mauserrifle/simresults/commit/9749984d0eccbcf2eb868aa8d6fda45695baa765