Skip to content
Snippets Groups Projects
Unverified Commit ae0a74ca authored by Chilja Gossow's avatar Chilja Gossow Committed by GitHub
Browse files

Extend RiskLevelStorage (DEV) (#2653)

* extension for checkIn risk
parent b25cf2ed
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package de.rki.coronawarnapp.risk.storage
import de.rki.coronawarnapp.risk.RiskLevelResult
import de.rki.coronawarnapp.risk.RiskLevelTaskResult
import de.rki.coronawarnapp.risk.TraceLocationCheckInRisk
import de.rki.coronawarnapp.risk.result.AggregatedRiskPerDateResult
import de.rki.coronawarnapp.risk.storage.internal.RiskResultDatabase
import de.rki.coronawarnapp.risk.storage.internal.riskresults.PersistedRiskLevelResultDao
......@@ -13,6 +14,7 @@ import de.rki.coronawarnapp.util.flow.shareLatest
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import timber.log.Timber
......@@ -126,14 +128,16 @@ abstract class BaseRiskLevelStorage constructor(
override val aggregatedRiskPerDateResults: Flow<List<AggregatedRiskPerDateResult>> by lazy {
aggregatedRiskPerDateResultTables.allEntries()
.map {
it.map {
persistedAggregatedRiskPerDateResult ->
it.map { persistedAggregatedRiskPerDateResult ->
persistedAggregatedRiskPerDateResult.toAggregatedRiskPerDateResult()
}
}
.shareLatest(tag = TAG, scope = scope)
}
override val traceLocationCheckInRiskStates: Flow<List<TraceLocationCheckInRisk>>
get() = flowOf(emptyList<TraceLocationCheckInRisk>()) // TODO("Not yet implemented")
private suspend fun insertAggregatedRiskPerDateResults(
aggregatedRiskPerDateResults: List<AggregatedRiskPerDateResult>
) {
......
package de.rki.coronawarnapp.risk.storage
import de.rki.coronawarnapp.risk.RiskLevelResult
import de.rki.coronawarnapp.risk.TraceLocationCheckInRisk
import de.rki.coronawarnapp.risk.result.AggregatedRiskPerDateResult
import kotlinx.coroutines.flow.Flow
......@@ -36,6 +37,12 @@ interface RiskLevelStorage {
*/
val aggregatedRiskPerDateResults: Flow<List<AggregatedRiskPerDateResult>>
/**
* Risk level per date/day and checkIn
* Used by contact diary overview
*/
val traceLocationCheckInRiskStates: Flow<List<TraceLocationCheckInRisk>>
suspend fun deleteAggregatedRiskPerDateResults(results: List<AggregatedRiskPerDateResult>)
suspend fun storeResult(result: RiskLevelResult)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment