- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: add functions to estimate monthly usage from data directly #9219
refactor: add functions to estimate monthly usage from data directly #9219
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
? chartDataSelection.month | ||
: currentMonth, | ||
data.datasets, | ||
traffic.usage?.apiData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ? is because usage
might be undefined. This is because the hook doesn't account for whether you have data or not. I'll address this in (yet another) followup.
frontend/src/component/admin/network/NetworkTrafficUsage/average-traffic-previous-months.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an incidental refactoring. We now filter the data before it goes into the component, so we can drop it here. Additionally, we have the current month defined elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moving the old functions back to where they were originally defined. Because we no longer want them in traffic-calculations, we might as well put them back so we remember to delete them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here are all about testing the new implementations against the old one. Given the same data in, they should get the same result out.
Adds new monthly estimation functions that operate on raw usage data instead of chart data. This brings those methods in line with the rest of the traffic calculation functions that we have in that file and means we can remove other external dependencies.
This is somewhat inspired by #9218, but not directly linked.