From 55f572194626c975604b2ea9fdfe42de5d02c35a Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Mon, 27 Aug 2012 18:13:06 +0200 Subject: [PATCH] Fix ratio bug (when downloading only part of the files), see issue 405.\nFixed Deluge highest priority bug, see issue 396. --- .../org/transdroid/daemon/Deluge/DelugeAdapter.java | 7 ++++--- lib/src/org/transdroid/daemon/Torrent.java | 10 ++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java b/lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java index 77e33c99..f3a1a427 100644 --- a/lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java +++ b/lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java @@ -614,10 +614,11 @@ public class DelugeAdapter implements IDaemonAdapter { return Priority.Off; case 2: return Priority.Normal; - case 3: + case 5: return Priority.High; + default: + return Priority.Low; } - return Priority.Low; } private int convertPriority(Priority priority) { @@ -627,7 +628,7 @@ public class DelugeAdapter implements IDaemonAdapter { case Normal: return 2; case High: - return 3; + return 5; default: return 1; } diff --git a/lib/src/org/transdroid/daemon/Torrent.java b/lib/src/org/transdroid/daemon/Torrent.java index f9eaed00..b9425d66 100644 --- a/lib/src/org/transdroid/daemon/Torrent.java +++ b/lib/src/org/transdroid/daemon/Torrent.java @@ -160,17 +160,11 @@ public final class Torrent implements Parcelable, Comparable { } /** - * Gives the upload/download seed ratio. If not downloading, - * it will base the ratio on the total size; so if you created the torrent yourself - * you will have downloaded 0 bytes, but the ratio will pretend you have 100%. + * Gives the upload/download seed ratio. * @return The ratio in range [0,r] */ public double getRatio() { - if (statusCode == TorrentStatus.Downloading) { - return ((double)uploadedEver) / ((double)downloadedEver); - } else { - return ((double)uploadedEver) / ((double)totalSize); - } + return ((double)uploadedEver) / ((double)downloadedEver); } /**