This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
Risk calculation cannot be restarted after time travel (EXPOSUREAPP-6646) #3327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After setting the device time into the future, a
Risk State
withCALCULATION_FAILED
is stored and the white error card is shown. After the user then sets the device time back to the correct time again, the white card is still there even after the user refreshes the risk calculation.The problem here is that when the device time is incorrect, the time of the device is taken as the
calculatedAt
property of theRiskState
. When the user then sets the correct time again, theRisk State
with the latestcalculatedAt
time is still the one withCALCULATION_FAILED
and so the white card stays there.After some big workaround ideas, @d4rken and especially @chiljamgossow gave me some useful hints for a better solution.
The solution proposed here is to simply use the server time instead of the incorrect device time for the
calculatedAt
property of theRisk State
. This fixes the issue but I am not completely sure if we aren't introducing other issues with this change.How to test