Hi,
The calculation after submitting values in the comments form is not correct.
When saving the record the numbers are calculated correctly.
Video: https://drive.google.com/file/d/1ZAeOpt ... sp=sharing
Wrong calculation numeric commentsfield
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong calculation numeric commentsfield
Sorry, can't reproduce it on my account.
Try to go to phpmyadmin and change field type to FLOAT for these fields.
Try to go to phpmyadmin and change field type to FLOAT for these fields.
Re: Wrong calculation numeric commentsfield
Unfortunately the problem persists after changing the field type.
Interestingly enough, the calculation is performed correctly when I edit and save the entity. Only when placing a comment it does not work properly.
Interestingly enough, the calculation is performed correctly when I edit and save the entity. Only when placing a comment it does not work properly.
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong calculation numeric commentsfield
Can you send me backup of your database to check in PM?
Re: Wrong calculation numeric commentsfield
I am a new user to the forum and unfortunately cannot send private messages.
Edit: After this message, it was possible. The message has been sent!
Edit: After this message, it was possible. The message has been sent!
Re: Wrong calculation numeric commentsfield
I found the problem. The system locale on my server was set to nl_NL. The default decimal separator in the Netherlands is a comma (,).
After calculating the new value (/modules/items/actions/comments.php, line #126) it was stored in the database with a comma (e.g. 7,15).
Setting the locale to en_US solved the problem. But perhaps it would be wise to catch this in the code as well.
Thanks for the help!
After calculating the new value (/modules/items/actions/comments.php, line #126) it was stored in the database with a comma (e.g. 7,15).
Setting the locale to en_US solved the problem. But perhaps it would be wise to catch this in the code as well.
Thanks for the help!
- support
- Site Admin
- Posts: 6222
- Joined: 19 Oct 2014, 18:22
- Name: Sergey Kharchishin
- Location: Russia, Evpatoriya
Re: Wrong calculation numeric commentsfield
This is something unusual. Function get_fields_sum return sum of numbers without formating so there is no bug in code.