commit
970f553a9e
2 changed files with 24 additions and 12 deletions
|
@ -713,7 +713,9 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
|
|||
override fun run() {
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.carbs = anInteger().toDouble()
|
||||
detailedBolusInfo.source = Source.USER
|
||||
detailedBolusInfo.date = secondLong()
|
||||
if (ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
|
||||
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
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
|
||||
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 {
|
||||
Treatment old;
|
||||
treatment.date = DatabaseHelper.roundDateToSec(treatment.date);
|
||||
|
|
Loading…
Reference in a new issue