Skip to content

Automation: a new glucose condition starts at the editor's lowest value - #5593

Open
olorinmaia wants to merge 2 commits into
nightscout:devfrom
olorinmaia:phone/fix/automation-new-glucose-threshold
Open

olorinmaia wants to merge 2 commits into
nightscout:devfrom
olorinmaia:phone/fix/automation-new-glucose-threshold

Conversation

@olorinmaia

Copy link
Copy Markdown
Collaborator

Problem

A new "Glucose" or "Temporary target value" condition started with the threshold 0.0, which the editor shows as an empty field. A condition saved without touching the field compared against 0: "below" never fired and "above" always fired, and nothing on the screen showed it.

Fix

  • InputBg starts at the lowest value of the units again, 54 mg/dL or 3.0 mmol/L (the fix and its tests are by @sashasochka, cherry-picked from the branch in the issue)
  • InputBg drops three private fields that nothing reads

Stored rules are read as stored. Rules already saved with 0 keep their behaviour.

Tests

NewGlucoseConditionTest (new, 3 tests) and InputBgTest pass. On device (Z Flip 5, full release, mmol/L): a new condition of each kind shows 3.0.

Before After
before after

Fixes #5570

sashasochka and others added 2 commits November 16, 2026 15:44
A new glucose or temp target condition started with the threshold 0.0.
The editor shows 0.0 as an empty field and only clamps it when the
field is focused, so a condition saved untouched compared the glucose
against 0: "below" never fired and "above" always did, with nothing on
the screen to show it.

The Java InputBg started at the lowest allowed value (e6ae4f0); that
line was lost when the class moved to dagger (a3b0c8c). Start at the
lowest value of the units again (54 mg/dL or 3.0 mmol/L), so the editor
shows the threshold that is used.

Stored rules are read as stored. Rules already saved with 0 keep
behaving as before; flagging those is left for a separate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2s3Q2DrsGAkKcHZPfBx4N
maxValue, step and decimalFormat were private and only written. The editor takes its range, step and format from the constants and the units.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants