You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(measurements): preserve supplied derived values on insert - #1593
Saving values one at a time can calculate BMI before the scale’s BMI is inserted, creating duplicate rows. Recalculating after import can also overwrite supplied derived values.
Save each new measurement and its supplied values in one transaction, then calculate only missing or invalid derived values. Use the same path for single saves, CSV and ContentProvider imports, keeping the existing recalculation rules for edits. Existing duplicate rows are not migrated.
Found while testing Tanita RD-545 support in #1592.
Validation: 1,083 unit tests pass; debug APK builds; instrumented tests compile; lint reports zero errors.
The duplicate rows are fixed on master in a70e938, though not the way this PR does it. A new
measurement is now inserted together with its values in one transaction, followed by a single
recalculation, and editing no longer adds a second row for a recalculated formula value.
What I didn't take over is keeping supplied derived values. Derived values (BMI, BMR, TDEE, ...)
are now always openScale's own calculation, and the connector drops what a scale reports for them.
Otherwise the same measurement would show a different value after an edit, which is the
inconsistency FILL_MISSING would have introduced. BMR instead got a formula setting like body fat
and water (Mifflin-St Jeor, Katch-McArdle, revised Harris-Benedict). For the Tanita PR this means
the scale's BMI and BMR won't be stored. Closing this one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Saving values one at a time can calculate BMI before the scale’s BMI is inserted, creating duplicate rows. Recalculating after import can also overwrite supplied derived values.
Save each new measurement and its supplied values in one transaction, then calculate only missing or invalid derived values. Use the same path for single saves, CSV and ContentProvider imports, keeping the existing recalculation rules for edits. Existing duplicate rows are not migrated.
Found while testing Tanita RD-545 support in #1592.
Validation: 1,083 unit tests pass; debug APK builds; instrumented tests compile; lint reports zero errors.