This commit is contained in:
Milos Kozak 2021-10-03 10:54:48 +02:00
commit de842ce1ee

View file

@ -1433,7 +1433,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
bolusID = insightDbHelper.getInsightBolusID(serial, event.getBolusID(), startTimestamp); // Line added to get id
if (event.getBolusType() == BolusType.STANDARD || event.getBolusType() == BolusType.MULTIWAVE) {
pumpSync.syncBolusWithPumpId(
startTimestamp,
bolusID.getTimestamp(),
event.getImmediateAmount(),
null,
bolusID.getId(),
@ -1443,7 +1443,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
if (event.getBolusType() == BolusType.EXTENDED || event.getBolusType() == BolusType.MULTIWAVE) {
if (event.getDuration() > 0 && profileFunction.getProfile(bolusID.getTimestamp()) != null)
pumpSync.syncExtendedBolusWithPumpId(
startTimestamp,
bolusID.getTimestamp(),
event.getExtendedAmount(),
timestamp - startTimestamp,
isFakingTempsByExtendedBoluses(),
@ -1557,8 +1557,6 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
}
private long parseRelativeDate(int year, int month, int day, int hour, int minute, int second, int relativeHour, int relativeMinute, int relativeSecond) {
if (relativeHour * 60 * 60 + relativeMinute * 60 + relativeSecond >= hour * 60 * 60 * minute * 60 + second)
day--;
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
@ -1566,7 +1564,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
calendar.set(Calendar.HOUR_OF_DAY, relativeHour);
calendar.set(Calendar.MINUTE, relativeMinute);
calendar.set(Calendar.SECOND, relativeSecond);
return calendar.getTimeInMillis();
long dayOffset =
relativeHour * 60 * 60 + relativeMinute * 60 + relativeSecond >= hour * 60 * 60 + minute * 60 + second ? T.Companion.days(1).msecs() : 0L;
return calendar.getTimeInMillis() - dayOffset;
}
private void uploadCareportalEvent(long date, DetailedBolusInfo.EventType event) {