fix setting zero temp

This commit is contained in:
Milos Kozak 2017-08-08 15:06:31 +02:00
parent cfe51757a1
commit 2f8ca8bb04

View file

@ -950,6 +950,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (tempBasal.source == Source.NIGHTSCOUT) {
old = getDaoTemporaryBasal().queryForId(tempBasal.date);
if (old != null) {
if (!old.isAbsolute && tempBasal.isAbsolute) { // converted to absolute by "ns_sync_use_absolute"
// so far ignore, do not convert back because it may not be accurate
return false;
}
if (!old.isEqual(tempBasal)) {
long oldDate = old.date;
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too