File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
app/lib/service/download_counts Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,11 @@ double computeRelativeGrowthRate(List<int> totalDownloads) {
3838 recentDownloads.reduce ((prev, element) => prev + element) /
3939 recentDownloads.length;
4040
41- if (averageRecentDownloads == 0 ) {
41+ final averageTotalDownloads =
42+ totalDownloads.reduce ((prev, element) => prev + element) /
43+ totalDownloads.length;
44+
45+ if (averageRecentDownloads == 0 || averageTotalDownloads == 0 ) {
4246 return 0 ;
4347 }
4448
@@ -51,7 +55,7 @@ double computeRelativeGrowthRate(List<int> totalDownloads) {
5155 // Normalize slope by average downloads to represent relative growth.
5256 // This measures how much the download count is growing relative to its
5357 // current volume.
54- return growthRate / averageRecentDownloads ;
58+ return growthRate / averageTotalDownloads ;
5559}
5660
5761/// Computes the slope of the best-fit line for a given list of data points
You can’t perform that action at this time.
0 commit comments