We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc575b4 commit 8d834e2Copy full SHA for 8d834e2
src/go/apps/auction-item-stat-scraper/converter/util.go
@@ -6,6 +6,10 @@ import (
6
)
7
8
func calculateAveragePrice(stats []loadb.AuctionItemStat) decimal.Decimal {
9
+ if len(stats) == 0 {
10
+ return decimal.NewFromInt(0)
11
+ }
12
+
13
totalPrice := decimal.NewFromInt(0)
14
for _, stat := range stats {
15
totalPrice = totalPrice.Add(decimal.NewFromInt(int64(stat.BuyPrice)))
0 commit comments