feat: percentDone double type

This commit is contained in:
wipedlifepotato
2026-08-22 14:56:11 +03:00
parent 0efeaaec6f
commit f177d2402f
+4 -2
View File
@@ -273,8 +273,10 @@ namespace torrents
{ "totalSize", [](std::shared_ptr<Torrent> torrent) { return boost::json::value(torrent->GetLength ()); } },
{ "percentDone", [](std::shared_ptr<Torrent> 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> torrent)