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

Why both toFixed(2) and Math.floor for productivity calculation? #107

Closed
mrv777 opened this issue May 10, 2016 · 0 comments
Closed

Why both toFixed(2) and Math.floor for productivity calculation? #107

mrv777 opened this issue May 10, 2016 · 0 comments
Assignees

Comments

@mrv777
Copy link
Contributor

mrv777 commented May 10, 2016

This productivity calculation seems to show up 3 times in the code, and I've been trying to find the error, but I can't :(

However, while trying to understand all the code, it seems to me that some steps seem redundant. Example spot of the code can be found here:
https://github.com/LiskHQ/lisk/blob/0d6c94768f212a23687fa58d8faae4782ede3b37/modules/accounts.js#L538

Now this may be for validation, but the line:
parseFloat(Math.floor(percent * 100) / 100).toFixed(2)

I would think could be written as:
Math.floor(percent * 100) / 100)
or
parseFloat((percent * 100) / 100).toFixed(2)

Not a big issue or anything, but trying to understand and help if I can :)

@karmacoma karmacoma self-assigned this May 10, 2016
MaciejBaj added a commit that referenced this issue Dec 5, 2018
Bump socketcluster and socketcluster-client versions - Closes #103
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