From f177d2402f471e86caa9b88e4d68de736ed750be Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Sat, 22 Aug 2026 14:56:11 +0300 Subject: [PATCH] feat: percentDone double type --- libi2pd_client/TorrentsRPC.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index af877772..b6a5f864 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -273,8 +273,10 @@ namespace torrents { "totalSize", [](std::shared_ptr torrent) { return boost::json::value(torrent->GetLength ()); } }, { "percentDone", [](std::shared_ptr torrent) { - if(!torrent->GetLength()) return boost::json::value ( 100 ); - return boost::json::value( (torrent->GetLength () - torrent->GetLeft ())*100/torrent->GetLength () ); + if(!torrent->GetLength()) return boost::json::value ( 100.0 ); + double left = torrent->GetLength () - torrent->GetLeft(); + double percent = (left*100)/torrent->GetLength(); + return boost::json::value( percent ); } }, { "hashString", [](std::shared_ptr torrent)