diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt index ab29bedbb9..9a79f5028d 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt @@ -49,7 +49,7 @@ class DashHistory @Inject constructor( @Suppress("ReturnCount") fun createRecord( commandType: OmnipodCommandType, - date: Long = System.currentTimeMillis(), + date: Long = currentTimeMillis(), initialResult: InitialResult = InitialResult.NOT_SENT, tempBasalRecord: TempBasalRecord? = null, bolusRecord: BolusRecord? = null, diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/ResultStates.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/ResultStates.kt index ee92d9ed78..676ba33168 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/ResultStates.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/data/ResultStates.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data enum class InitialResult { - NOT_SENT, FAILURE_SENDING, UNCONFIRMED, SENT + NOT_SENT, FAILURE_SENDING, SENT } enum class ResolvedResult { diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/HistoryRecordEntity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/HistoryRecordEntity.kt index 18ff9c14d2..d4a613a75b 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/HistoryRecordEntity.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/database/HistoryRecordEntity.kt @@ -20,4 +20,15 @@ data class HistoryRecordEntity( @Embedded(prefix = "bolusRecord_") val bolusRecord: BolusRecord?, val resolvedResult: ResolvedResult?, val resolvedAt: Long? -) +) { + fun displayTimestamp(): Long { + resolvedAt?.let { + return it + } + return date + } + + fun isSuccess(): Boolean { + return initialResult == InitialResult.SENT && resolvedResult == ResolvedResult.SUCCESS + } +} 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 e6c8c7da7f..72622ae4a7 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 @@ -171,13 +171,14 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) { val record: HistoryRecordEntity = historyList[position] record?.let { - holder.timeView.text = DateTimeUtil.toStringFromTimeInMillis(record.date) + holder.timeView.text = DateTimeUtil.toStringFromTimeInMillis(record.displayTimestamp()) setValue(record, holder.valueView) setType(record, holder.typeView) } } private fun setType(record: HistoryRecordEntity, typeView: TextView) { + typeView.text = resourceHelper.gs(record.commandType.resourceId) } private fun setValue(historyEntry: HistoryRecordEntity, valueView: TextView) {