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