Merge Dev, Fix new uel.log in NSClientPlugin
This commit is contained in:
parent
4ce59b929a
commit
e89aaf4d11
6 changed files with 17 additions and 6 deletions
|
@ -154,7 +154,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
extendedBolusCancel?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isInHistoryExtendedBoluslInProgress) {
|
||||
if (activePlugin.activeTreatments.isInHistoryExtendedBolusInProgress) {
|
||||
uel.log(Action.CANCEL_EXTENDED_BOLUS)
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
|
|
|
@ -30,6 +30,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.database.AppRepository;
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget;
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*;
|
||||
import info.nightscout.androidaps.database.transactions.SyncTemporaryTargetTransaction;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
|
@ -423,7 +424,7 @@ public class NSClientPlugin extends PluginBase {
|
|||
// room Temporary target
|
||||
TemporaryTarget temporaryTarget = temporaryTargetFromNsIdForInvalidating(_id);
|
||||
disposable.add(repository.runTransactionForResult(new SyncTemporaryTargetTransaction(temporaryTarget)).subscribe(
|
||||
result -> result.getInvalidated().forEach(record -> uel.log("TT DELETED FROM NS", record.getReason().getText(), record.getLowTarget(), record.getHighTarget(), (int) record.getDuration(), 0)),
|
||||
result -> result.getInvalidated().forEach(record -> uel.log(Action.TT_DELETED_FROM_NS, new ValueWithUnit(record.getReason().getText(), Units.TT_Reason), new ValueWithUnit(record.getLowTarget(), Units.Mg_Dl), new ValueWithUnit(record.getHighTarget(), Units.Mg_Dl), new ValueWithUnit((int) record.getDuration(), Units.M))),
|
||||
error -> aapsLogger.error(LTag.BGSOURCE, "Error while saving temporary target", error)));
|
||||
// new DB model
|
||||
EventNsTreatment evtTreatment = new EventNsTreatment(EventNsTreatment.Companion.getREMOVE(), json);
|
||||
|
@ -453,9 +454,9 @@ public class NSClientPlugin extends PluginBase {
|
|||
if (temporaryTarget != null) {
|
||||
disposable.add(repository.runTransactionForResult(new SyncTemporaryTargetTransaction(temporaryTarget)).subscribe(
|
||||
result -> {
|
||||
result.getInserted().forEach(record -> uel.log("TT FROM NS", record.getReason().getText(), record.getLowTarget(), record.getHighTarget(), (int) record.getDuration(), 0));
|
||||
result.getInvalidated().forEach(record -> uel.log("TT DELETED FROM NS", record.getReason().getText(), record.getLowTarget(), record.getHighTarget(), (int) record.getDuration(), 0));
|
||||
result.getEnded().forEach(record -> uel.log("TT CANCELED FROM NS", record.getReason().getText(), record.getLowTarget(), record.getHighTarget(), (int) record.getDuration(), 0));
|
||||
result.getInserted().forEach(record -> uel.log(Action.TT_FROM_NS, new ValueWithUnit(record.getReason().getText(), Units.TT_Reason), new ValueWithUnit(record.getLowTarget(), Units.Mg_Dl), new ValueWithUnit(record.getHighTarget(), Units.Mg_Dl), new ValueWithUnit((int) record.getDuration(), Units.M)));
|
||||
result.getInvalidated().forEach(record -> uel.log(Action.TT_DELETED_FROM_NS, new ValueWithUnit(record.getReason().getText(), Units.TT_Reason), new ValueWithUnit(record.getLowTarget(), Units.Mg_Dl), new ValueWithUnit(record.getHighTarget(), Units.Mg_Dl), new ValueWithUnit((int) record.getDuration(), Units.M)));
|
||||
result.getEnded().forEach(record -> uel.log(Action.TT_CANCELED_FROM_NS, new ValueWithUnit(record.getReason().getText(), Units.TT_Reason), new ValueWithUnit(record.getLowTarget(), Units.Mg_Dl), new ValueWithUnit(record.getHighTarget(), Units.Mg_Dl), new ValueWithUnit((int) record.getDuration(), Units.M)));
|
||||
},
|
||||
error -> aapsLogger.error(LTag.BGSOURCE, "Error while saving temporary target", error)));
|
||||
} else {
|
||||
|
|
|
@ -194,7 +194,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
${dateUtil.dateAndTimeString(tempTarget.timestamp)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempTarget.reason, Units.TT_Reason), ValueWithUnit(tempTarget.date, Units.Timestamp), ValueWithUnit(tempTarget.low, Units.Mg_Dl), ValueWithUnit(tempTarget.high, Units.Mg_Dl), ValueWithUnit(tempTarget.durationInMinutes, Units.M))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempTarget.reason.text, Units.TT_Reason), ValueWithUnit(tempTarget.timestamp, Units.Timestamp), ValueWithUnit(tempTarget.lowTarget, Units.Mg_Dl), ValueWithUnit(tempTarget.highTarget, Units.Mg_Dl), ValueWithUnit(tempTarget.duration.toInt(), Units.M))
|
||||
disposable += repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(tempTarget.id))
|
||||
.subscribe({
|
||||
val id = tempTarget.interfaceIDs.nightscoutId
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.utils.extensions
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
|
||||
|
@ -98,6 +99,9 @@ fun UserEntry.Action.stringId(): Int {
|
|||
this == UserEntry.Action.SMS_PUMP_DISCONNECT -> R.string.uel_sms_pump_disconnect
|
||||
this == UserEntry.Action.SMS_SMS -> R.string.uel_sms_sms
|
||||
this == UserEntry.Action.SMS_TT -> R.string.uel_sms_tt
|
||||
this == UserEntry.Action.TT_DELETED_FROM_NS -> R.string.uel_tt_deleted_from_ns
|
||||
this == UserEntry.Action.TT_FROM_NS -> R.string.uel_tt_from_ns
|
||||
this == UserEntry.Action.TT_CANCELED_FROM_NS -> R.string.uel_tt_canceleted_from_ns
|
||||
else -> R.string.uel_unknown
|
||||
}
|
||||
}
|
||||
|
|
|
@ -481,6 +481,9 @@
|
|||
<string name="uel_sms_pump_disconnect">SMS PUMP DISCONNECT</string>
|
||||
<string name="uel_sms_sms">SMS SMS</string>
|
||||
<string name="uel_sms_tt">SMS TT</string>
|
||||
<string name="uel_tt_deleted_from_ns">TT DELETED FROM NS</string>
|
||||
<string name="uel_tt_from_ns">TT FROM NS</string>
|
||||
<string name="uel_tt_canceleted_from_ns">TT CANCELED FROM NS</string>
|
||||
<string name="uel_unknown">UNKNOWN</string>
|
||||
<string name="formated_string">Formated string</string>
|
||||
|
||||
|
|
|
@ -112,6 +112,9 @@ data class UserEntry(
|
|||
@SerializedName("SMS_PUMP_DISCONNECT") SMS_PUMP_DISCONNECT,
|
||||
@SerializedName("SMS_SMS") SMS_SMS,
|
||||
@SerializedName("SMS_TT") SMS_TT,
|
||||
@SerializedName("TT_DELETED_FROM_NS") TT_DELETED_FROM_NS,
|
||||
@SerializedName("TT_FROM_NS") TT_FROM_NS,
|
||||
@SerializedName("TT_CANCELED_FROM_NS") TT_CANCELED_FROM_NS,
|
||||
@SerializedName("UNKNOWN") UNKNOWN
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue