Skip to content
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

Conversation

LukasLechnerDev
Copy link
Contributor

Description

After setting the device time into the future, a Risk State with CALCULATION_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 the RiskState. When the user then sets the correct time again, the Risk State with the latest calculatedAt time is still the one with CALCULATION_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 the Risk State. This fixes the issue but I am not completely sure if we aren't introducing other issues with this change.

How to test

  • Perform Risk calculation with the correct time and see green/red risk card appear
  • Set the device time a couple of days into the future
  • Go back to CWA and see the white card appear
  • Set the device time back to the correct time
  • Re-trigger the Risk calculation
  • green/red risk card should appear again

@LukasLechnerDev LukasLechnerDev requested a review from a team May 31, 2021 07:41
@chiljamgossow chiljamgossow self-assigned this May 31, 2021
@harambasicluka harambasicluka added the maintainers Tag pull requests created by maintainers label May 31, 2021
@harambasicluka harambasicluka added this to the 2.4.0 milestone May 31, 2021
chiljamgossow
chiljamgossow previously approved these changes May 31, 2021
Copy link
Contributor

@chiljamgossow chiljamgossow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlexanderAlferov AlexanderAlferov self-assigned this Jun 1, 2021
Copy link
Contributor

@AlexanderAlferov AlexanderAlferov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀
Tested on Samsung S8

@sonarcloud
Copy link

sonarcloud bot commented Jun 1, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@AlexanderAlferov AlexanderAlferov merged commit ed31156 into release/2.4.x Jun 1, 2021
@AlexanderAlferov AlexanderAlferov deleted the fix/6646-Risk-Calculation-Issues-on-Time-Travel branch June 1, 2021 13:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintainers Tag pull requests created by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants