burnedikt / diasend-nightscout-bridge

Synchronize your diasend data to nightscout.
MIT License
18 stars 18 forks source link

Correction Boli ignore total value #29

Closed burnedikt closed 1 year ago

burnedikt commented 1 year ago

As is: Correction Boli are only imported using the "programmed" value, which may be overridden by the user

Should: Correction Boli should take the total value into account instead.

https://github.com/burnedikt/diasend-nightscout-bridge/blob/184691c00b6f4e81dad511006b25d6fbf93d8a3c/adapter.ts#L204

E.g. the following bolus will be imported with insulin 0 when it should actually be 0.5:

{
    "type": "insulin_bolus",
    "created_at": "2023-01-03T22:26:56",
    "unit": "U",
    "total_value": 0.5,
    "spike_value": 0.5,
    "suggested": 0,
    "suggestion_overridden": "yes",
    "suggestion_based_on_bg": "yes",
    "suggestion_based_on_carb": "no",
    "programmed_bg_correction": 0.001,
    "flags": [
        {
            "flag": 1034,
            "description": "Bolus type ezbg"
        }
    ]
}