Add QuickWizard Source (Solution TBC, information got through Note, so I create a "complicated String" to avoid Fake QuickWizard in UserEntry)

This commit is contained in:
Philoul 2021-03-29 23:47:21 +02:00
parent d607b855b0
commit 61d84e66fe
8 changed files with 15 additions and 6 deletions

View file

@ -90,7 +90,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
binding.refreshFromNightscout.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
uel.log(Action.TREATMENTS_NS_REFRESH)
uel.log(Action.TREATMENTS_NS_REFRESH, ValueWithUnit(Sources.Treatments))
disposable +=
Completable.fromAction {
repository.deleteAllBolusCalculatorResults()
@ -110,7 +110,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
binding.deleteFutureTreatments.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable {
uel.log(Action.DELETE_FUTURE_TREATMENTS)
uel.log(Action.DELETE_FUTURE_TREATMENTS, ValueWithUnit(Sources.Treatments))
repository
.getBolusesDataFromTime(dateUtil._now(), false)
.observeOn(aapsSchedulers.main)
@ -333,6 +333,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
uel.log(
Action.TREATMENT_REMOVED,
ValueWithUnit(Sources.Treatments),
ValueWithUnit(bolus.timestamp, Units.Timestamp),
ValueWithUnit(bolus.amount, Units.U)
// ValueWithUnit(mealLinkLoaded.carbs.toInt(), Units.G)
@ -355,6 +356,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
uel.log(
Action.TREATMENT_REMOVED,
ValueWithUnit(Sources.Treatments),
ValueWithUnit(carb.timestamp, Units.Timestamp),
ValueWithUnit(carb.amount, Units.G)
)

View file

@ -164,7 +164,11 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
profileSwitch.profileObject?.let {
//uel.log(Action.PROFILE_SWITCH_CLONED, XXXValueWithUnit.Timestamp(profileSwitch.date), XXXValueWithUnit.SimpleString(profileSwitch.profileName))
uel.log(Action.PROFILE_SWITCH_CLONED, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_") , ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp), ValueWithUnit(profileSwitch.profileName, Units.None))
uel.log(Action.PROFILE_SWITCH_CLONED,
profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_"),
ValueWithUnit(Sources.Treatments),
ValueWithUnit(profileSwitch.date, Units.Timestamp),
ValueWithUnit(profileSwitch.profileName, Units.None))
val nonCustomized = it.convertToNonCustomizedProfile()
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))

View file

@ -416,8 +416,8 @@ class BolusWizard @Inject constructor(
carbs.equals(0.0) -> Action.BOLUS
else -> Action.TREATMENT
}
uel.log(action, if (notes == resourceHelper.gs(R.string.key_quickwizard)) quickWizard.getActive()?.buttonText() else notes,
ValueWithUnit(if (notes == resourceHelper.gs(R.string.key_quickwizard)) Sources.QuickWizard else Sources.WizardDialog),
uel.log(action, if (notes == resourceHelper.gs(R.string.ue_quickwizard_ID)) quickWizard.getActive()?.buttonText() else notes, // ue_quickwizard_ID is complicated string impossible to write as note in WizardDialog
ValueWithUnit(if (notes == resourceHelper.gs(R.string.ue_quickwizard_ID)) Sources.QuickWizard else Sources.WizardDialog),
ValueWithUnit(eventType.toDBbEventType().text, Units.TherapyEvent),
ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0),
ValueWithUnit(this@BolusWizard.carbs, Units.G, this@BolusWizard.carbs != 0),

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.JsonHelper.safeGetInt
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
import info.nightscout.androidaps.utils.extensions.valueToUnits
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.json.JSONException
import org.json.JSONObject
@ -31,6 +32,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
@Inject lateinit var loopPlugin: LoopPlugin
@Inject lateinit var iobCobCalculatorPlugin: IobCobCalculatorPlugin
@Inject lateinit var repository: AppRepository
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider
@ -124,7 +126,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
trend = true
}
val percentage = sp.getInt(R.string.key_boluswizard_percentage, 100)
return BolusWizard(injector).doCalc(profile, profileName, tempTarget, carbs(), cob, bg, 0.0, percentage, true, useCOB() == YES, bolusIOB, basalIOB, superBolus, useTempTarget() == YES, trend, false, "QuickWizard")
return BolusWizard(injector).doCalc(profile, profileName, tempTarget, carbs(), cob, bg, 0.0, percentage, true, useCOB() == YES, bolusIOB, basalIOB, superBolus, useTempTarget() == YES, trend, false, resourceHelper.gs(R.string.ue_quickwizard_ID)) // ue_quickwizard_ID is complicated string impossible to write as note in WizardDialog
}
fun buttonText(): String = safeGetString(storage, "buttonText", "")

View file

@ -481,6 +481,7 @@
<string name="ue_none">No Unit</string>
<string name="ue_export_to_csv">Export User Entries to Excel (csv)</string>
<string name="ue_csv_header">"%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"</string>
<string name="ue_quickwizard_ID" translatable="false">L!DujFNpR?D5TY9EH1DJ</string>
<plurals name="days">
<item quantity="one">%1$d day</item>