Skip to content
Snippets Groups Projects
Unverified Commit ed311567 authored by Lukas Lechner's avatar Lukas Lechner Committed by GitHub
Browse files

Risk calculation cannot be restarted after time travel (EXPOSUREAPP-6646) (#3327)


* Store Risk Result at current server time in case the device time is incorrect

* Fix RiskLevelTaskTest.kt

* Fix RiskLevelTaskTest.kt by not using hardcoded instant value

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
Co-authored-by: default avatarChilja Gossow <49635654+chiljamgossow@users.noreply.github.com>
Co-authored-by: default avatarAlexanderAlferov <64849422+AlexanderAlferov@users.noreply.github.com>
parent f5c2bdee
No related branches found
No related tags found
No related merge requests found
......@@ -93,8 +93,10 @@ class RiskLevelTask @Inject constructor(
if (!configData.isDeviceTimeCorrect) {
Timber.w("Device time is incorrect, offset: %s", configData.localOffset)
val currentServerTime = nowUTC.minus(configData.localOffset)
Timber.d("Calculated current server time: %s", currentServerTime)
return EwRiskLevelTaskResult(
calculatedAt = nowUTC,
calculatedAt = currentServerTime,
failureReason = FailureReason.INCORRECT_DEVICE_TIME
)
}
......
......@@ -137,8 +137,10 @@ class RiskLevelTaskTest : BaseTest() {
every { configData.isDeviceTimeCorrect } returns false
every { configData.localOffset } returns Duration.standardHours(5)
val serverTime = testTimeNow.minus(configData.localOffset)
createTask().run(arguments) shouldBe EwRiskLevelTaskResult(
calculatedAt = testTimeNow,
calculatedAt = serverTime,
failureReason = EwRiskLevelResult.FailureReason.INCORRECT_DEVICE_TIME
)
}
......
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