Fix unit detection.

This commit is contained in:
Timothy Allen 2018-01-03 23:38:37 +02:00
parent 5394bcee7c
commit 6959174863

View File

@ -704,7 +704,7 @@ def verify_units(units = None, high = None, low = None):
''' Standardise units for output and for the A1c calculations ''' ''' Standardise units for output and for the A1c calculations '''
if re.search('mg', units, flags=re.IGNORECASE) is not None: if re.search('mg', units, flags=re.IGNORECASE) is not None:
units = UNIT_MGDL units = UNIT_MGDL
elif re.search('mg', units, flags=re.IGNORECASE) is not None: elif re.search('mm', units, flags=re.IGNORECASE) is not None:
units = UNIT_MMOLL units = UNIT_MMOLL
elif isinstance(high, (int, float)) or isinstance(low, (int, float)): elif isinstance(high, (int, float)) or isinstance(low, (int, float)):
''' If units are not specified by the arguments or calling function, let's assume they are ''' If units are not specified by the arguments or calling function, let's assume they are