Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Removed traces of grey risk card (EXPOSUREAPP-3051) #1699

Merged
merged 20 commits into from
Nov 25, 2020

Conversation

SamuraiKek
Copy link
Contributor

@SamuraiKek SamuraiKek commented Nov 23, 2020

  • Removes the initial "unknown risk" grey card
  • Adds a new card for "Failed because no internet"
  • Refactored the RiskLevel to be determined by two other values. Our "RiskLevel" is now based on the whether "does an aggregated result exist" and "a failure reason which must exist if there is no aggregated result". This makes us very flexible to add new failure states the the risk level calculation process. The FailureReasons are enums stored in a database. More robust than the previous plain numbers.
  • Simplified the RiskCardState by dropping manual key retrieval time an using "isBackgroundJobEnabled" directly.

Testing

Try to produce all different card states 😉

@SamuraiKek SamuraiKek requested a review from a team November 23, 2020 15:05
@SamuraiKek SamuraiKek added the enhancement Improvement of an existing feature label Nov 23, 2020
@SamuraiKek SamuraiKek added this to the 1.8.0 milestone Nov 23, 2020
@harambasicluka harambasicluka changed the title Removed traces of grey risk card. Removed traces of grey risk card (EXPOSUREAPP-3051) Nov 24, 2020
@@ -58,7 +56,6 @@ enum class RiskLevel(val raw: Int) {
)
private val HIGH_RISK_LEVELS = arrayOf(INCREASED_RISK)
private val LOW_RISK_LEVELS = arrayOf(
UNKNOWN_RISK_INITIAL,
NO_CALCULATION_POSSIBLE_TRACING_OFF,
LOW_LEVEL_RISK,
UNKNOWN_RISK_OUTDATED_RESULTS,
Copy link
Member

Choose a reason for hiding this comment

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

What do we need this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were using it for displaying the grey risk cards. Basically before the risk calculation could take place after the onboarding, the initial risk score was attributed this constant value. By removing the grey card, I don't see a need for this constant anymore as the initial risk value is attributed to the LOW_RISK constant now.

Comment on lines +274 to +275
RiskLevelConstants.UNKNOWN_RISK_OUTDATED_RESULTS,
RiskLevelConstants.UNKNOWN_RISK_OUTDATED_RESULTS_MANUAL ->
Copy link
Member

Choose a reason for hiding this comment

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

What do we need this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While these two are also used in relation to the grey risk card, they are also needed for displaying the "Risiko-Ermittlung
nicht möglich" card which is a white card from what I can see in the Android Figma file. AFAIK there are instances where the risk calculation can fail after it's been calculated at least once, so these constants should be relevant for the cards with the white background (at least for now).

RiskLevelConstants.LOW_LEVEL_RISK -> R.color.colorSemanticLowRisk
else -> R.color.colorSemanticNeutralRisk
else -> R.color.colorSemanticUnknownRisk
Copy link
Member

Choose a reason for hiding this comment

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

What do we need this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opposite to what the names suggest, the colorSemanticNeutralRisk is the grey color used for the grey card, and colorSemanticUnknownRisk is white. The fallback color was grey before and I've now changed it to white since there won't be a grey card anymore.
Maybe these color names should be interchanged but I didn't want to introduce more unnecessary modifications for now.

@harambasicluka
Copy link
Contributor

@mlenkeit should all grey cards be removed or only the initial one?

@harambasicluka
Copy link
Contributor

Agreed with @mlenkeit that this is fine, but @SamuraiKek could you verify when UNKNOWN_RISK_OUTDATED_RESULTS would be visible? Not sure when i have seen it the last time? I think it's in but technically overruled by the white card.

@d4rken d4rken self-assigned this Nov 24, 2020
@d4rken d4rken self-requested a review November 24, 2020 16:20
@SamuraiKek
Copy link
Contributor Author

Agreed with @mlenkeit that this is fine, but @SamuraiKek could you verify when UNKNOWN_RISK_OUTDATED_RESULTS would be visible? Not sure when i have seen it the last time? I think it's in but technically overruled by the white card.

I'm not sure when it would be visible. I think the values are assigned in RiskLevelTask, when the calculationNotPossibleBecauseOfOutdatedResults() method is called. Now whether this method is ever called, or if the values are overwritten someplace else, I'm not really sure right now. I'll try and look more into it when working on #1615 but for now, I don't see why keeping them in would cause any issue.

# Conflicts:
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevel.kt
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevelTask.kt
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/RiskLevelRepository.kt
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/tracing/card/TracingCardState.kt
#	Corona-Warn-App/src/main/res/values-bg/strings.xml
#	Corona-Warn-App/src/main/res/values-de/strings.xml
#	Corona-Warn-App/src/main/res/values-en/strings.xml
#	Corona-Warn-App/src/main/res/values-pl/strings.xml
#	Corona-Warn-App/src/main/res/values-ro/strings.xml
#	Corona-Warn-App/src/main/res/values-tr/strings.xml
#	Corona-Warn-App/src/main/res/values/strings.xml
#	Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/RiskLevelTest.kt
#	Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/tracing/card/TracingCardStateTest.kt
harambasicluka
harambasicluka previously approved these changes Nov 25, 2020
Copy link
Contributor

@harambasicluka harambasicluka left a comment

Choose a reason for hiding this comment

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

To resolve the merge conflicts it should be fine if you just add the removed strings again and only remove them in german.

@harambasicluka harambasicluka self-assigned this Nov 25, 2020
Refactored "RiskLevel" to be calculated based on either result or failure reasons.
Added the new "no internet" error card.
# Conflicts:
#	Corona-Warn-App/src/main/res/values-bg/strings.xml
#	Corona-Warn-App/src/main/res/values-en/strings.xml
#	Corona-Warn-App/src/main/res/values-pl/strings.xml
#	Corona-Warn-App/src/main/res/values-ro/strings.xml
#	Corona-Warn-App/src/main/res/values-tr/strings.xml
#	Corona-Warn-App/src/main/res/values/strings.xml
@Oliver-Zimmerman
Copy link
Contributor

If we remove the UNKNOWN state then this PR becomes obsolete:
#1686

Copy link
Contributor

@harambasicluka harambasicluka left a comment

Choose a reason for hiding this comment

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

Looks really good! I just got one question, will go to device testing now.

harambasicluka
harambasicluka previously approved these changes Nov 25, 2020
Copy link
Contributor

@harambasicluka harambasicluka left a comment

Choose a reason for hiding this comment

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

I tested the following states, please correct me if I missed one:

  • INCREASED_RISK -> via test menu
  • LOW_LEVEL_RISK -> initially at the start
  • UNKNOWN_RISK_OUTDATED_RESULTS -> disabled tracing
  • UNKNOWN_RISK_OUTDATED_RESULTS_MANUAL -> not able to get into this state, but I'm also not sure when I've seen it the last time, should be investigated in a follow up ticket
  • UNKNOWN_RISK_NO_INTERNET -> turned wifi off, time traveled, forced risk calculation via tester menu

image

@harambasicluka harambasicluka self-assigned this Nov 25, 2020
@harambasicluka harambasicluka added the maintainers Tag pull requests created by maintainers label Nov 25, 2020
@sonarqubecloud
Copy link

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

52.1% 52.1% Coverage
0.0% 0.0% Duplication

@d4rken d4rken self-assigned this Nov 25, 2020
@d4rken d4rken merged commit 86b29f7 into release/1.8.x Nov 25, 2020
@d4rken d4rken deleted the feature/remove_grey_risk_cards branch November 25, 2020 17:41
@vaubaehn
Copy link
Contributor

Agreed with @mlenkeit that this is fine, but @SamuraiKek could you verify when UNKNOWN_RISK_OUTDATED_RESULTS would be visible? Not sure when i have seen it the last time? I think it's in but technically overruled by the white card.

I'm not sure when it would be visible. I think the values are assigned in RiskLevelTask, when the calculationNotPossibleBecauseOfOutdatedResults() method is called. Now whether this method is ever called, or if the values are overwritten someplace else, I'm not really sure right now. I'll try and look more into it when working on #1615 but for now, I don't see why keeping them in would cause any issue.

Iirc it's also visible in the current version when there is a failure with exposure checking for more than 24 hrs (API 39508, API 10 no public key, BackgroundWorker does not start...), but tracing is on - see also #1081 (EXPOSUREAPP-2796). For now, failure and tracing off will result in the same risk card. But I understood

We move to a new risklevel/failure data state [...]

like this will be addressed elsewhere?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement of an existing feature maintainers Tag pull requests created by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants