Merge pull request #429 from Philoul/FixCarePortalNoteNull
Allow null notes in UserEntryLogger
This commit is contained in:
commit
7f95144564
|
@ -196,7 +196,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.notes_label) + ": " + (therapyEvent.note ?: "") + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(therapyEvent.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log(Action.CAREPORTAL_REMOVED, therapyEvent.note ?: "", ValueWithUnit(therapyEvent.type.text, Units.TherapyEvent), ValueWithUnit(therapyEvent.timestamp, Units.Timestamp))
|
||||
uel.log(Action.CAREPORTAL_REMOVED, therapyEvent.note , ValueWithUnit(therapyEvent.timestamp, Units.Timestamp), ValueWithUnit(therapyEvent.type.text, Units.TherapyEvent))
|
||||
disposable += repository.runTransactionForResult(InvalidateTherapyEventTransaction(therapyEvent.id))
|
||||
.subscribe({
|
||||
val id = therapyEvent.interfaceIDs.nightscoutId
|
||||
|
|
|
@ -196,7 +196,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
${dateUtil.dateAndTimeString(tempTarget.timestamp)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempTarget.reason.text, Units.TherapyEvent), ValueWithUnit(tempTarget.timestamp, Units.Timestamp), ValueWithUnit(tempTarget.lowTarget, Units.Mg_Dl), ValueWithUnit(tempTarget.highTarget, Units.Mg_Dl, tempTarget.lowTarget != tempTarget.highTarget), ValueWithUnit(tempTarget.duration.toInt(), Units.M))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(tempTarget.timestamp, Units.Timestamp), ValueWithUnit(tempTarget.reason.text, Units.TherapyEvent), ValueWithUnit(tempTarget.lowTarget, Units.Mg_Dl), ValueWithUnit(tempTarget.highTarget, Units.Mg_Dl, tempTarget.lowTarget != tempTarget.highTarget), ValueWithUnit(tempTarget.duration.toInt(), Units.M))
|
||||
disposable += repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(tempTarget.id))
|
||||
.subscribe({
|
||||
val id = tempTarget.interfaceIDs.nightscoutId
|
||||
|
|
|
@ -20,14 +20,14 @@ class UserEntryLogger @Inject constructor(
|
|||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
fun log(action: Action, s: String, vararg listvalues: ValueWithUnit) {
|
||||
fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
||||
val values = mutableListOf<ValueWithUnit>()
|
||||
for (v in listvalues){
|
||||
if (v.condition) values.add(v)
|
||||
}
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = s,
|
||||
s = s ?:"",
|
||||
values = values
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
|
@ -56,10 +56,10 @@ class UserEntryLogger @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
fun log(action: Action, s: String = "") {
|
||||
fun log(action: Action, s: String? = "") {
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = s
|
||||
s = s ?:""
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
|
@ -69,10 +69,10 @@ class UserEntryLogger @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
fun log(action: Action, s: String = "", values: MutableList<ValueWithUnit>) {
|
||||
fun log(action: Action, s: String? = "", values: MutableList<ValueWithUnit>) {
|
||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||
action = action,
|
||||
s = s,
|
||||
s = s ?:"",
|
||||
values = values
|
||||
))
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
|
|
Loading…
Reference in a new issue