Skip to content

Handle 0 downloads in growth function #8741

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

Merged
merged 2 commits into from
May 7, 2025
Merged

Conversation

szakarias
Copy link
Contributor

No description provided.

@@ -35,6 +35,10 @@ double computeRelativeGrowthRate(List<int> totalDownloads) {
recentDownloads.reduce((prev, element) => prev + element) /
recentDownloads.length;

if (averageRecentDownloads == 0) {
Copy link
Member

Choose a reason for hiding this comment

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

< 1 might also be worth considering...

Packages with average downloads less than one shouldn't have their growthrate increased..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll keep it in mind but I'll keep it as it is for now. This is the mathematically correct calculation, and hence keeps the abstraction of the function clear. On the caller site we will handle packages with few downloads.

@szakarias szakarias merged commit 56e05ed into dart-lang:master May 7, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants