SMS: set TT type correctly
This commit is contained in:
parent
1932966a63
commit
f980d2f73c
1 changed files with 5 additions and 1 deletions
|
@ -966,6 +966,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var keyTarget = 0
|
||||
var defaultTargetMMOL = 0.0
|
||||
var defaultTargetMGDL = 0.0
|
||||
var reason = TemporaryTarget.Reason.EATING_SOON
|
||||
when {
|
||||
isMeal -> {
|
||||
keyDuration = R.string.key_eatingsoon_duration
|
||||
|
@ -973,6 +974,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
keyTarget = R.string.key_eatingsoon_target
|
||||
defaultTargetMMOL = Constants.defaultEatingSoonTTmmol
|
||||
defaultTargetMGDL = Constants.defaultEatingSoonTTmgdl
|
||||
reason = TemporaryTarget.Reason.EATING_SOON
|
||||
}
|
||||
|
||||
isActivity -> {
|
||||
|
@ -981,6 +983,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
keyTarget = R.string.key_activity_target
|
||||
defaultTargetMMOL = Constants.defaultActivityTTmmol
|
||||
defaultTargetMGDL = Constants.defaultActivityTTmgdl
|
||||
reason = TemporaryTarget.Reason.ACTIVITY
|
||||
}
|
||||
|
||||
isHypo -> {
|
||||
|
@ -989,6 +992,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
keyTarget = R.string.key_hypo_target
|
||||
defaultTargetMMOL = Constants.defaultHypoTTmmol
|
||||
defaultTargetMGDL = Constants.defaultHypoTTmgdl
|
||||
reason = TemporaryTarget.Reason.HYPOGLYCEMIA
|
||||
}
|
||||
}
|
||||
var ttDuration = sp.getInt(keyDuration, defaultTargetDuration)
|
||||
|
@ -999,7 +1003,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction(
|
||||
timestamp = dateUtil.now(),
|
||||
duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()),
|
||||
reason = TemporaryTarget.Reason.EATING_SOON,
|
||||
reason = reason,
|
||||
lowTarget = Profile.toMgdl(tt, profileFunction.getUnits()),
|
||||
highTarget = Profile.toMgdl(tt, profileFunction.getUnits())
|
||||
)).subscribe({ result ->
|
||||
|
|
Loading…
Reference in a new issue