nightscout / Trio

MIT License
64 stars 259 forks source link

Inconsistent ExternalInsulin type enum and isExternalInsulin attribute #102

Closed avouspierre closed 4 months ago

avouspierre commented 4 months ago

With the #93 the model PumpHistoryEvent is modified to add external insulin Type and a isExternalInsulin boolean :

struct type
CleanShot 2024-04-14 at 11 20 24 CleanShot 2024-04-14 at 11 20 54

However, when a external insulin is added with the interface, only the externalInsulin bool is defined to true (the type = bolus and no externalInsulin) : CleanShot 2024-04-14 at 11 24 50

I also found a function never used by any code where isExternalInsulin = true CleanShot 2024-04-14 at 11 22 52

The externalInsulinType is used by NS (and only by NS) to build a nightscoutTreatement object with a function to deduce the type : https://github.com/nightscout/Open-iAPS/blob/8ebd52a69612977cf705c5843d71250eb23bb009/FreeAPS/Sources/APS/Storage/PumpHistoryStorage.swift#L260

My proposal will be to remove the externalInsulin Type in Event Type and create a specific type enum for NS, avoid to have inconsistent between type and isExtrernalInsulin attribue.

avouspierre commented 4 months ago

tested with #110 PR