]> Some of my projects - localmylist.git/commitdiff
Try rounding the vote before casting to int.
authorAPTX <marek321@gmail.com>
Sat, 8 Aug 2015 18:19:32 +0000 (20:19 +0200)
committerAPTX <marek321@gmail.com>
Sat, 8 Aug 2015 18:19:32 +0000 (20:19 +0200)
localmylist/requesthandler.cpp

index f5d8392cb950f2814abdbd2b321a976e1755b818..62f151a85ccf44ab24043b8a52f4960119d1cf8d 100644 (file)
@@ -1,5 +1,7 @@
 #include "requesthandler.h"
 
+#include <cmath>
+
 #include "mylist.h"
 #include "database.h"
 #include "settings.h"
@@ -148,7 +150,7 @@ void RequestHandler::handleMyListUpdates()
                        if (request.vote < 1.0 || request.vote > 10.0)
                                cmd.setValue(-1);
                        else
-                               cmd.setValue(int(request.vote * 100));
+                               cmd.setValue(static_cast<int>(std::nearbyint(request.vote * 100)));
 
                        VoteReply *reply = Client::instance()->send(cmd);
                        connect(reply, SIGNAL(replyReady(bool)), this, SLOT(myListUpdateVoteReplyComplete(bool)));