Skip to content

Commit 3b9ea53

Browse files
committed
Fix TempTarget confirm dialog
1 parent 0ff7702 commit 3b9ea53

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ class TempTargetDialog : DialogFragmentWithDate() {
114114
val reason = overview_temptarget_reason.selectedItem.toString()
115115
val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
116116
val target = overview_temptarget_temptarget.value
117-
val duration = overview_temptarget_duration.value
118-
if (target != 0.0 && duration != 0.0) {
117+
val duration = overview_temptarget_duration.value.toInt()
118+
if (target != 0.0 && duration != 0) {
119119
actions.add(MainApp.gs(R.string.reason) + ": " + reason)
120120
actions.add(MainApp.gs(R.string.nsprofileview_target_label) + ": " + Profile.toCurrentUnitsString(target) + " " + MainApp.gs(unitResId))
121-
actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_hours, duration))
121+
actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_mins, duration))
122122
} else {
123123
actions.add(MainApp.gs(R.string.stoptemptarget))
124124
}
@@ -128,7 +128,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
128128
activity?.let { activity ->
129129
OKDialog.showConfirmation(activity, MainApp.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
130130
log.debug("USER ENTRY: TEMP TARGET $target duration: $duration")
131-
if (target == 0.0 || duration == 0.0) {
131+
if (target == 0.0 || duration == 0) {
132132
val tempTarget = TempTarget()
133133
.date(eventTime)
134134
.duration(0)
@@ -145,7 +145,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
145145
.high(Profile.toMgdl(target, ProfileFunctions.getSystemUnits()))
146146
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget)
147147
}
148-
if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
148+
if (duration == 10) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
149149
})
150150
}
151151
return true

0 commit comments

Comments
 (0)