Skip to content
Snippets Groups Projects
Unverified Commit 8e35f507 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Fix crashing PCR test result update worker (DEV) (#3003)

* Correctly filter results to those that we targeted during refresh.

* Remove unnecessary test result logging, will be logged elsewhere already.

* Spacing.
parent 67c07c96
No related branches found
No related tags found
No related merge requests found
...@@ -188,7 +188,7 @@ class CoronaTestRepository @Inject constructor( ...@@ -188,7 +188,7 @@ class CoronaTestRepository @Inject constructor(
} }
} }
return refreshedData.values.toSet() return refreshedData.values.filter { toRefresh.contains(it.identifier) }.toSet()
} }
suspend fun clear() { suspend fun clear() {
......
...@@ -9,7 +9,6 @@ import dagger.assisted.AssistedInject ...@@ -9,7 +9,6 @@ import dagger.assisted.AssistedInject
import de.rki.coronawarnapp.coronatest.CoronaTestRepository import de.rki.coronawarnapp.coronatest.CoronaTestRepository
import de.rki.coronawarnapp.coronatest.latestPCRT import de.rki.coronawarnapp.coronatest.latestPCRT
import de.rki.coronawarnapp.coronatest.type.CoronaTest import de.rki.coronawarnapp.coronatest.type.CoronaTest
import de.rki.coronawarnapp.coronatest.type.pcr.PCRCoronaTest
import de.rki.coronawarnapp.util.worker.InjectedWorkerFactory import de.rki.coronawarnapp.util.worker.InjectedWorkerFactory
import de.rki.coronawarnapp.worker.BackgroundConstants import de.rki.coronawarnapp.worker.BackgroundConstants
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
...@@ -42,12 +41,9 @@ class PCRResultRetrievalWorker @AssistedInject constructor( ...@@ -42,12 +41,9 @@ class PCRResultRetrievalWorker @AssistedInject constructor(
return Result.success() return Result.success()
} }
Timber.tag(TAG).d(" $id Running task.") Timber.tag(TAG).v("$id Running PCR test result refresh.")
val coronaTest = coronaTestRepository.refresh( coronaTestRepository.refresh(type = CoronaTest.Type.PCR)
type = CoronaTest.Type.PCR Timber.tag(TAG).d("$id: PCR test result refreshed.")
).single() as PCRCoronaTest
val testResult = coronaTest.testResult
Timber.tag(TAG).d("$id: Test result retrieved is $testResult")
return Result.success() return Result.success()
} catch (e: Exception) { } catch (e: Exception) {
......
...@@ -46,8 +46,9 @@ class RAResultRetrievalWorker @AssistedInject constructor( ...@@ -46,8 +46,9 @@ class RAResultRetrievalWorker @AssistedInject constructor(
Timber.tag(TAG).w("There is no RapidAntigen test available!?") Timber.tag(TAG).w("There is no RapidAntigen test available!?")
return Result.success() return Result.success()
} }
Timber.tag(TAG).v("$id Running RA test result refresh.")
coronaTestRepository.refresh(CoronaTest.Type.RAPID_ANTIGEN) coronaTestRepository.refresh(CoronaTest.Type.RAPID_ANTIGEN)
Timber.tag(TAG).d("$id: RA test result refreshed.")
val nowUTC = timeStamper.nowUTC val nowUTC = timeStamper.nowUTC
val days = Duration(rat.registeredAt, nowUTC).standardDays val days = Duration(rat.registeredAt, nowUTC).standardDays
......
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