fix database cleanup

This commit is contained in:
Milos Kozak 2023-02-08 18:08:07 +01:00
parent 0f4dd15a27
commit e62bb19b49
3 changed files with 4 additions and 3 deletions

View file

@ -123,7 +123,7 @@ import kotlin.math.roundToInt
val ret = StringBuilder() val ret = StringBuilder()
removed removed
.filter { it.second > 0 } .filter { it.second > 0 }
.map { ret.append(it.first + " " + it.second + "\n") } .map { ret.append(it.first + " " + it.second + "<br>") }
return ret.toString() return ret.toString()
} }

View file

@ -31,7 +31,7 @@ class PersistenceLayerImpl @Inject constructor(
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
override fun clearDatabases() = repository.clearDatabases() override fun clearDatabases() = repository.clearDatabases()
override fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String = cleanupDatabase(keepDays, deleteTrackedChanges) override fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String = repository.cleanupDatabase(keepDays, deleteTrackedChanges)
override fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult) { override fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult) {
disposable += repository.runTransactionForResult(InsertOrUpdateBolusCalculatorResultTransaction(bolusCalculatorResult)) disposable += repository.runTransactionForResult(InsertOrUpdateBolusCalculatorResultTransaction(bolusCalculatorResult))

View file

@ -119,7 +119,8 @@ class MaintenanceFragment : DaggerFragment() {
onError = { aapsLogger.error("Error cleaning up databases", it) }, onError = { aapsLogger.error("Error cleaning up databases", it) },
onComplete = { onComplete = {
if (result.isNotEmpty()) if (result.isNotEmpty())
OKDialog.show(activity, rh.gs(info.nightscout.core.ui.R.string.result), HtmlHelper.fromHtml("<b>" + rh.gs(R.string.cleared_entries) + "</b>\n" + result).toSpanned()) OKDialog.show(activity, rh.gs(info.nightscout.core.ui.R.string.result), HtmlHelper.fromHtml("<b>" + rh.gs(R.string.cleared_entries) + "</b><br>" + result)
.toSpanned())
aapsLogger.info(LTag.CORE, "Cleaned up databases with result: $result") aapsLogger.info(LTag.CORE, "Cleaned up databases with result: $result")
} }
) )