Simplified multiplier calculation
This commit is contained in:
parent
c7ba216b34
commit
9cd48dfede
|
|
@ -82,7 +82,6 @@ public class WorkerCardAdapter{
|
||||||
|
|
||||||
price.setText(String.format(Locale.ROOT, "%.8f", worker.getPrice()));
|
price.setText(String.format(Locale.ROOT, "%.8f", worker.getPrice()));
|
||||||
|
|
||||||
//TODO: If short and old_long and next_so_price<switch_price, set color to green
|
|
||||||
nextSoPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getNextSoPrice()));
|
nextSoPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getNextSoPrice()));
|
||||||
if (worker.isShort() &&
|
if (worker.isShort() &&
|
||||||
worker.getOldLongDictionary()!=null &&
|
worker.getOldLongDictionary()!=null &&
|
||||||
|
|
@ -147,8 +146,7 @@ public class WorkerCardAdapter{
|
||||||
} else if (worker.isAuto()) {
|
} else if (worker.isAuto()) {
|
||||||
String stringToDisplay = "AUTO";
|
String stringToDisplay = "AUTO";
|
||||||
if (worker.getPrice()!=0) {
|
if (worker.getPrice()!=0) {
|
||||||
double percentageToSwitch = (worker.getOldLongDictionary().getTpPrice()-worker.getPrice())*100/worker.getPrice();
|
int multiplier = (int) (worker.getOldLongDictionary().getTpPrice() / worker.getPrice());
|
||||||
int multiplier = (int) (percentageToSwitch/100+1);
|
|
||||||
if (multiplier>1) {
|
if (multiplier>1) {
|
||||||
stringToDisplay = stringToDisplay + " x" + multiplier;
|
stringToDisplay = stringToDisplay + " x" + multiplier;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue