calaldees / KaraKara

Karaoke Event System - Attendees can view and queue tracks from their mobile phones
https://karakara.uk
GNU General Public License v3.0
28 stars 9 forks source link

Use integers for Queue Item IDs #108

Closed shish closed 2 years ago

shish commented 2 years ago

Floating point numbers can have rounding issues when we're transferring data between Python and JS, or between 64-bit servers and 32-bit phones, etc - the server says "the next track in the list is 0.666" and the client says "Ah I see, the next track is 0.67"

This PR changes things to use 30-bit integers, which should be lossless across all platforms

calaldees commented 2 years ago

Sensible change. I was being super lazy with floats and assumed they would always be in the 32bit range ... but python is 64bit based and this would have created a world of issues.