beyond-all-reason / teiserver

Middleware server for online gaming
https://www.beyondallreason.info/
MIT License
61 stars 53 forks source link

Fix error when unprocessed match #517

Closed jauggy closed 2 weeks ago

jauggy commented 1 month ago

Fixes https://discord.com/channels/549281623154229250/1273218599653343262/1298564953107857419

L-e-x-o-n commented 4 weeks ago

While this should work fine, I think it might be better to use the processed boolean from the match instead. It would make it immediately clearer why it's used and it seems like good practice that could be applied to similar cases in the future where some match data might not yet be available.

jauggy commented 4 weeks ago

Ok will do later in the week

L-e-x-o-n commented 3 weeks ago

It seems the error happens for AI matches as well, do you know if are marked as processed?

jauggy commented 3 weeks ago

It looks like you can have a match that is processed but not have any rating_logs (which triggers the error). E.g. unrated or bot matches.

jauggy commented 3 weeks ago

@L-e-x-o-n can you try deploy this on integration and check a bot match? I have one: https://server5.beyondallreason.info/battle/3376408 Also any unrated match too.

We cannot use processed boolean because it's possible for match to be processed but not have any rating logs (which triggers the error). I've just added more comments to the code to make it more obvious.

L-e-x-o-n commented 2 weeks ago

@L-e-x-o-n can you try deploy this on integration and check a bot match? I have one: https://server5.beyondallreason.info/battle/3376408 Also any unrated match too.

We cannot use processed boolean because it's possible for match to be processed but not have any rating logs (which triggers the error). I've just added more comments to the code to make it more obvious.

Sorry for the delay, I deployed and tested, it's working! Thanks