Skip to content

Commit

Permalink
Blood glucose assertion and unit fix
Browse files Browse the repository at this point in the history
Changes from here: imdzx#16
  • Loading branch information
maxbeech committed Oct 14, 2023
1 parent 9aeac62 commit fdd26c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class FlutterHealthConnectPlugin(private var channel: MethodChannel? = null) : F
BLOOD_GLUCOSE -> BloodGlucoseRecord(
time = Instant.parse(recordMap["time"] as String),
zoneOffset = if (recordMap["zoneOffset"] != null) ZoneOffset.ofHours(recordMap["zoneOffset"] as Int) else null,
level = BloodGlucose.millimolesPerLiter(recordMap["level"] as Double),
level = BloodGlucose.milligramsPerDeciliter(recordMap["level"] as Double),
specimenSource = recordMap["specimenSource"] as Int,
mealType = recordMap["mealType"] as Int,
relationToMeal = recordMap["relationToMeal"] as Int,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/records/blood_glucose_record.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class BloodGlucoseRecord extends InstantaneousRecord {
this.relationToMeal = RelationToMeal.unknown,
this.mealType = MealType.unknown,
metadata})
: assert(level.value <= _maxLevel.value),
assert(level.value >= _minLevel.value),
: assert(level.inMilligramsPerDeciliter <= _maxLevel.inMilligramsPerDeciliter),
assert(level.inMilligramsPerDeciliter >= _minLevel.inMilligramsPerDeciliter),
metadata = metadata ?? Metadata.empty();

static const BloodGlucose _maxLevel = BloodGlucose.millimolesPerLiter(50.0);
Expand Down

0 comments on commit fdd26c7

Please sign in to comment.