Open noamyft opened 7 years ago
I just spartinzed my class. After I run the test, I discovered 2 tests failed. When I looked into it, I discover that the spartanizer change my code: Form this:
return storePackages.stream().map(sp -> { long periodInDays = ChronoUnit.DAYS.between(currentDate, sp.getExpirationDate()); double ratio = periodInDays == 0 ? 0 : sp.getAmount() / periodInDays; return new HighRatioAmountExpirationTimeProperty(ratio, sp); }).filter(p -> p.getRatio() >= HighRatioAmountExpirationTimeProperty.ratioThreshold) .collect(Collectors.toSet());
To this:
return storePackages.stream().map(sp -> { long periodInDays = ChronoUnit.DAYS.between(currentDate, sp.getExpirationDate()); double ratio = periodInDays == 0 ? 0 : periodInDays * sp.getAmount() / 1.; return new HighRatioAmountExpirationTimeProperty(ratio, sp); }).filter(p -> p.getRatio() >= HighRatioAmountExpirationTimeProperty.ratioThreshold) .collect(Collectors.toSet());
Meaning, this: sp.getAmount() / periodInDays changed to this: *periodInDays sp.getAmount() / 1.**
From what I understand, it changed the operation from division to multiplication. If so, this is seriously bad.
@ravivos why did you assigned me? I am not related to arithmetic tippers. Talk to Yossi/Niv please.
I just spartinzed my class. After I run the test, I discovered 2 tests failed. When I looked into it, I discover that the spartanizer change my code: Form this:
To this:
Meaning, this: sp.getAmount() / periodInDays changed to this: *periodInDays sp.getAmount() / 1.**
From what I understand, it changed the operation from division to multiplication. If so, this is seriously bad.