In sonar (v2), whenever an account transitions from some status to 'Active', a HistoricalDataUsage is created for it. This didn't always happen, though - so there are accounts with no HistoricalDataUsage, which will break the Data Usage and Billing pages of the Customer Portal.
Here, we add some conditions to provide default values if the history doesn't exist.
There is another PR in sonar to create DataUsageHistories for all active accounts, which is this: https://github.com/SonarSoftwareInc/sonar/pull/3305. Which should prevent these conditions from ever being needed.
https://dev.azure.com/sonarsoftware/Sonar/_workitems/edit/3212
In sonar (v2), whenever an account transitions from some status to 'Active', a HistoricalDataUsage is created for it. This didn't always happen, though - so there are accounts with no HistoricalDataUsage, which will break the Data Usage and Billing pages of the Customer Portal.
Here, we add some conditions to provide default values if the history doesn't exist.
There is another PR in sonar to create DataUsageHistories for all active accounts, which is this: https://github.com/SonarSoftwareInc/sonar/pull/3305. Which should prevent these conditions from ever being needed.
Instead of