This commit is contained in:
lolouk44 2020-02-03 10:44:10 +00:00
parent 34255e9023
commit 2d7c52de44
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
from math import floor from math import floor
import sys
from body_scales import bodyScales from body_scales import bodyScales
class bodyMetrics: class bodyMetrics:
@ -17,15 +18,15 @@ class bodyMetrics:
exit() exit()
elif weight < 10 or weight > 200: elif weight < 10 or weight > 200:
print("Weight is either too low or too high (limits: <10kg and >200kg) or scale is sleeping") print("Weight is either too low or too high (limits: <10kg and >200kg) or scale is sleeping")
sys.stderr.write('Weight is above 10kg or below 200kg or scale is sleeping\n') sys.stderr.write('Weight is above 10kg or below 200kg or scale is sleeping\n')
exit() exit()
elif age > 99: elif age > 99:
print("Age is too high (limit >99 years) or scale is sleeping") print("Age is too high (limit >99 years) or scale is sleeping")
sys.stderr.write('Age is above 99 years or scale is sleeping\n') sys.stderr.write('Age is above 99 years or scale is sleeping\n')
exit() exit()
elif impedance > 3000: elif impedance > 3000:
print("Impedance is above 3000ohm or scale is sleeping") print("Impedance is above 3000ohm or scale is sleeping")
sys.stderr.write('Impedance is above 3000ohm or scale is sleeping\n') sys.stderr.write('Impedance is above 3000ohm or scale is sleeping\n')
exit() exit()
# Set the value to a boundary if it overflows # Set the value to a boundary if it overflows

View file

@ -95,11 +95,11 @@ class bodyScore:
return self.getMalus(self.bodyfat, scale[3], scale[2], 20, 10) + 10.0 return self.getMalus(self.bodyfat, scale[3], scale[2], 20, 10) + 10.0
# High part of normal fat # High part of normal fat
elif self.bodyfat <= normal[2]: elif self.bodyfat <= scale[2]:
return self.getMalus(self.bodyfat, scale[2], best, 3, 9) + 3.0 return self.getMalus(self.bodyfat, scale[2], best, 3, 9) + 3.0
# Very low in fat # Very low in fat
elif self.bodyfat < normal[0]: elif self.bodyfat < scale[0]:
return self.getMalus(self.bodyfat, 1.0, scale[0], 3, 10) + 3.0 return self.getMalus(self.bodyfat, 1.0, scale[0], 3, 10) + 3.0