1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

(web) #4841 & #4842 Fix inspector statistics when multiple torrents are selected. Fix the ratio displayed when the download count for a single transfer is 0 but there is data on disk.

This commit is contained in:
Mitchell Livingston 2012-03-20 00:41:57 +00:00
parent 496290d263
commit 306bd497b8

View file

@ -203,8 +203,8 @@ function Inspector(controller) {
else { else {
d = f = 0; d = f = 0;
for(i=0; t=torrents[i]; ++i) { for(i=0; t=torrents[i]; ++i) {
d = t.getDownloadedEver(); d += t.getDownloadedEver();
f = t.getFailedEver(); f += t.getFailedEver();
} }
if(f) if(f)
str = fmt.size(d) + ' (' + fmt.size(f) + ' corrupt)'; str = fmt.size(d) + ' (' + fmt.size(f) + ' corrupt)';
@ -221,10 +221,19 @@ function Inspector(controller) {
str = none; str = none;
else { else {
d = u = 0; d = u = 0;
for(i=0; t=torrents[i]; ++i) { if(torrents.length == 1) {
d = t.getDownloadedEver(); d = torrents[0].getDownloadedEver();
u = t.getUploadedEver(); u = torrents[0].getUploadedEver();
if (d == 0)
d = torrents[0].getHaveValid();
} }
else {
for(i=0; t=torrents[i]; ++i) {
d += t.getDownloadedEver();
u += t.getUploadedEver();
}
}
str = fmt.size(u) + ' (Ratio: ' + fmt.ratioString( Math.ratio(u,d))+')'; str = fmt.size(u) + ' (Ratio: ' + fmt.ratioString( Math.ratio(u,d))+')';
} }
setInnerHTML(e.uploaded_lb, str); setInnerHTML(e.uploaded_lb, str);