mirror of
https://github.com/transmission/transmission
synced 2024-12-29 19:16:23 +00:00
Merge pull request #234 from muesli/master
Fix sorting by progress (Qt client)
This commit is contained in:
commit
c19e49d851
2 changed files with 6 additions and 1 deletions
|
@ -314,7 +314,7 @@ public:
|
|||
|
||||
double percentComplete() const
|
||||
{
|
||||
return haveTotal() / static_cast<double>(totalSize());
|
||||
return totalSize() != 0 ? haveTotal() / static_cast<double>(totalSize()) : 0;
|
||||
}
|
||||
|
||||
double percentDone() const
|
||||
|
|
|
@ -155,6 +155,11 @@ bool TorrentFilter::lessThan(QModelIndex const& left, QModelIndex const& right)
|
|||
// fall through
|
||||
|
||||
case SortMode::SORT_BY_PROGRESS:
|
||||
if (val == 0)
|
||||
{
|
||||
val = -compare(a->isMagnet(), b->isMagnet());
|
||||
}
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
val = compare(a->percentComplete(), b->percentComplete());
|
||||
|
|
Loading…
Reference in a new issue