File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
core/data/src/main/java/com/crisiscleanup/core/data/repository Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import com.crisiscleanup.core.database.dao.IncidentDao
1010import com.crisiscleanup.core.database.dao.IncidentDaoPlus
1111import com.crisiscleanup.core.datastore.AccountInfoDataSource
1212import com.crisiscleanup.core.model.data.IncidentClaimThreshold
13+ import com.crisiscleanup.core.model.data.IncidentsData
1314import kotlinx.coroutines.flow.first
1415import java.util.concurrent.ConcurrentHashMap
1516import javax.inject.Inject
@@ -48,7 +49,13 @@ class CrisisCleanupIncidentClaimThresholdRepository @Inject constructor(
4849 incidentThresholds : List <IncidentClaimThreshold >,
4950 ) {
5051 try {
51- incidentDaoPlus.saveIncidentThresholds(accountId, incidentThresholds)
52+ val incidentsData = incidentSelector.data.value
53+ val incidentIds = (incidentsData as ? IncidentsData .Incidents )?.incidents
54+ ?.map { it.id }
55+ ?.toSet()
56+ ? : emptySet()
57+ val thresholds = incidentThresholds.filter { incidentIds.contains(it.incidentId) }
58+ incidentDaoPlus.saveIncidentThresholds(accountId, thresholds)
5259 } catch (e: Exception ) {
5360 logger.logException(e)
5461 }
You can’t perform that action at this time.
0 commit comments