From 269e94a8b5f1f9c18521dbbf82bae46c1a828530 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Sun, 24 Oct 2021 11:01:43 +0200 Subject: [PATCH] get history --- .../pump/omnipod/dash/ui/DashPodHistoryActivity.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt index ee5d1c60be..390b183f90 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt @@ -39,7 +39,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { private var statusView: TextView? = null private var recyclerView: RecyclerView? = null private var linearLayoutManager: LinearLayoutManager? = null - private val fullHistoryList: List = ArrayList() + private val fullHistoryList: MutableList = ArrayList() private val filteredHistoryList: MutableList = ArrayList() private var recyclerViewAdapter: RecyclerViewAdapter? = null private var manualChange = false @@ -47,10 +47,14 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { private fun prepareData() { val gc = GregorianCalendar() - gc.add(Calendar.HOUR_OF_DAY, -24) + // TODO: limit to the last 3 days. Using 30days here for testing + gc.add(Calendar.DAY_OF_MONTH, -30) - // - //fullHistoryList.addAll(dashHistory.getRecordsAfter(gc.getTimeInMillis())); + val since = gc.timeInMillis + val records = dashHistory.getRecordsAfter(since) + .subscribeOn(aapsSchedulers.io) + .blockingGet() + fullHistoryList.addAll(records) } private fun filterHistory(group: PumpHistoryEntryGroup) {