MarkMpn / AutotuneWeb

A web interface for running Autotune
45 stars 31 forks source link

Make ToMgDl more tolerant #9

Closed dabear closed 5 years ago

dabear commented 5 years ago

https://github.com/MarkMpn/AutotuneWeb/blob/68216f90babaf5452a243eb98de7c61819a7ff71/AutotuneWeb/Models/NSProfile.cs#L129

That code assumed the unit name is "mmol". I am using @kdisimone's Loop "anna" branch that automatically uploads profiles to nightscout. If I access mysite/api/v1/profile/current, my unit name is instead "mmol/L". this results in autotuneweb running with an isf that is not multiplied with 18 even though is should.

Suggested fix:

 private decimal ToMgDl(decimal value)
        {
            if (this.Units.ToLower().Contains("mmol"))
                return value * 18;

            return value;
        }
dabear commented 5 years ago

@MarkMpn as noted on gitter. This is a fix for https://github.com/MarkMpn/AutotuneWeb/issues/5 as well., which was incorrectly closed(?)

MarkMpn commented 5 years ago

Merged in https://github.com/MarkMpn/AutotuneWeb/commit/2d15d35799c61361a364d5bcedcd01d02c549a28