commit
970f553a9e
2 changed files with 24 additions and 12 deletions
|
@ -713,7 +713,9 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val detailedBolusInfo = DetailedBolusInfo()
|
val detailedBolusInfo = DetailedBolusInfo()
|
||||||
detailedBolusInfo.carbs = anInteger().toDouble()
|
detailedBolusInfo.carbs = anInteger().toDouble()
|
||||||
|
detailedBolusInfo.source = Source.USER
|
||||||
detailedBolusInfo.date = secondLong()
|
detailedBolusInfo.date = secondLong()
|
||||||
|
if (ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
|
||||||
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
@ -727,6 +729,12 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true)
|
||||||
|
var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||||
|
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
||||||
|
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,10 @@ public class TreatmentService extends OrmLiteBaseService<DatabaseHelper> {
|
||||||
|
|
||||||
// return true if new record is created
|
// return true if new record is created
|
||||||
public UpdateReturn createOrUpdate(Treatment treatment) {
|
public UpdateReturn createOrUpdate(Treatment treatment) {
|
||||||
|
if (treatment != null && treatment.source == Source.NONE) {
|
||||||
|
log.error("Coder error: source is not set for treatment: " + treatment, new Exception());
|
||||||
|
FabricPrivacy.logException(new Exception("Coder error: source is not set for treatment: " + treatment));
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Treatment old;
|
Treatment old;
|
||||||
treatment.date = DatabaseHelper.roundDateToSec(treatment.date);
|
treatment.date = DatabaseHelper.roundDateToSec(treatment.date);
|
||||||
|
|
Loading…
Reference in a new issue