when sorting by progress, if seeding, sort by progress towards meeting set ratio

This commit is contained in:
Mitchell Livingston 2007-05-28 03:17:23 +00:00
parent eab0827294
commit 2f8eb2edb9
2 changed files with 14 additions and 2 deletions

View File

@ -1394,7 +1394,18 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (NSNumber *) progressSortKey
{
return [NSNumber numberWithFloat: [self progress]];
float progress;
if ((progress = [self progress]) >= 1.0)
{
float stopRatio, ratio;
if ((stopRatio = [self actualStopRatio]) == INVALID)
progress = 3.0;
else if (stopRatio > 0 && (ratio = [self ratio]) >= 0 && ratio <= stopRatio)
progress += ratio / stopRatio;
else;
}
return [NSNumber numberWithFloat: progress];
}
- (NSNumber *) ratioSortKey

View File

@ -85,7 +85,8 @@
{
float stopRatio, ratio;
if ((stopRatio = [[info objectForKey: @"StopRatio"] floatValue]) != INVALID
&& (ratio = [[info objectForKey: @"Ratio"] floatValue]) < stopRatio)
&& (ratio = [[info objectForKey: @"Ratio"] floatValue]) < stopRatio
&& stopRatio != 0)
{
if (ratio < 0)
ratio = 0;