Skip to content

[BUG] Negative carb entry incorrectly limited by max carb setting, 3.4.1.0-dev #4637

@gerison77

Description

@gerison77

Negative carb entry incorrectly limited by max carb setting

Description
When attempting to reduce current COB (Carbs On Board) by entering a negative carb value, the input is incorrectly constrained by the configured maximum carb entry limit. This prevents valid negative adjustments even when COB would remain positive after the deduction.

Steps to Reproduce

  1. Set maximum carb entry limit to 36g
  2. Accumulate COB of e.g. 45g (via multiple entries)
  3. Attempt to enter -40g carbs to reduce COB

Expected Behavior

  • Negative carb entries should be allowed as long as resulting COB ≥ 0
  • The max carb limit should only apply to positive carb entries

Actual Behavior

  • Entry of -40g is blocked because it exceeds the max carb limit (36g)
  • User cannot reduce COB in a single step even though resulting COB would remain positive

Impact

  • Forces users to split corrections into multiple steps
  • Introduces unnecessary friction in manual COB adjustments

Suggested Fix

  • Apply max carb limit only to positive carb entries
  • Allow negative carb inputs up to current COB value (i.e., prevent COB < 0, but not restrict by max carb setting)

Workaround

  • Reduce COB in multiple steps (e.g., -36g then -4g)

Additional Context
This scenario occurs when COB exceeds the configured max carb limit due to multiple prior entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions