1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-06 22:42:33 +00:00

fix: update Torrent::ratio() to match #2770 (#5193)

This commit is contained in:
Charles Kerr 2023-03-10 14:32:12 -06:00 committed by GitHub
parent 86fd89fff4
commit be77226d6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -300,10 +300,9 @@ public:
[[nodiscard]] constexpr auto ratio() const noexcept [[nodiscard]] constexpr auto ratio() const noexcept
{ {
auto const u = uploadedEver(); auto const numerator = static_cast<double>(uploadedEver());
auto const d = downloadedEver(); auto const denominator = sizeWhenDone();
auto const t = totalSize(); return denominator > 0U ? numerator / denominator : double{};
return double(u) / (d ? d : t);
} }
[[nodiscard]] constexpr double percentComplete() const noexcept [[nodiscard]] constexpr double percentComplete() const noexcept