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

[rainbow6siege] stats divide by 0 error for newer players #81

Closed
MHLoppy opened this issue Feb 7, 2018 · 1 comment
Closed

[rainbow6siege] stats divide by 0 error for newer players #81

MHLoppy opened this issue Feb 7, 2018 · 1 comment

Comments

@MHLoppy
Copy link

MHLoppy commented Feb 7, 2018

I am submitting a...

 [x] Bug report
 [ ] Feature request or improvement for an existing cog

Name of the cog in question:

rainbow6siege

Description of my issue/request:

Usage of "stats" command for newer players causes a divide by 0 error because the Ubisoft API stopped tracking shots fired (but not shots landed) at some point. Consequently, the bot tries to p.bullets_hit / p.bullets_fired when bullets_fired is 0.

If it's a bug, steps to reproduce:

  1. Use stats command with a newish (last 2~4 months?) player as the input (only tested on Uplay platform)

If it's a bug, a stack trace:

[I already dirty-fixed this locally with the below code, so I no longer have a stack trace available, but it clearly indicated there was a divide by 0 error]

Known fix:

Add a check of "if 0, substitute with 1" to the shots fired count in the "Shots" field, e.g.

(p.bullets_hit / p.bullets_fired if
	p.bullets_fired > 0 else 1) * 100),
	p.headshots)

(I'd put in a pr but I've honestly forgotten how to do that since the last time I had to use git)

@tmercswims
Copy link
Owner

Good catch! As someone who doesn't have a newer account, I never would have found this.

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