mirror of
https://github.com/transmission/transmission
synced 2024-12-27 10:07:40 +00:00
fix ratio showing as -0.01
This commit is contained in:
parent
b6048d3220
commit
d9ff2d6105
1 changed files with 4 additions and 2 deletions
|
@ -25,6 +25,8 @@
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import <transmission.h>
|
#import <transmission.h>
|
||||||
|
|
||||||
|
#warning better rounding
|
||||||
|
|
||||||
@implementation NSString (NSStringAdditions)
|
@implementation NSString (NSStringAdditions)
|
||||||
|
|
||||||
+ (NSString *) ellipsis
|
+ (NSString *) ellipsis
|
||||||
|
@ -96,9 +98,9 @@
|
||||||
else;
|
else;
|
||||||
|
|
||||||
if (ratio < 10.0)
|
if (ratio < 10.0)
|
||||||
return [NSString localizedStringWithFormat: @"%.2f", ratio];
|
return [NSString localizedStringWithFormat: @"%.2f", MAX(0.0, ratio - .005)];
|
||||||
else if (ratio < 100.0)
|
else if (ratio < 100.0)
|
||||||
return [NSString localizedStringWithFormat: @"%.1f", ratio];
|
return [NSString localizedStringWithFormat: @"%.1f", ratio - .05];
|
||||||
else
|
else
|
||||||
return [NSString localizedStringWithFormat: @"%.0f", ratio];
|
return [NSString localizedStringWithFormat: @"%.0f", ratio];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue