From e2de0e463f5980056cab3dd56a8e2a201e7bcd91 Mon Sep 17 00:00:00 2001 From: Gurjot Date: Wed, 4 Dec 2024 14:38:24 +0530 Subject: [PATCH] fix --- internal/services/stats.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/services/stats.go b/internal/services/stats.go index 2f031a9..26d21ea 100644 --- a/internal/services/stats.go +++ b/internal/services/stats.go @@ -192,10 +192,11 @@ func (s *Services) GetOverallStats( price, err := s.GetLatestBtcPriceUsd(ctx) if err != nil { log.Ctx(ctx).Error().Err(err).Msg("error while fetching latest btc price") - btcPrice = nil + btcPrice = nil // return empty field if error + } else { + roundedPrice := math.Round(price*100) / 100 + btcPrice = &roundedPrice } - roundedPrice := math.Round(price*100) / 100 - btcPrice = &roundedPrice } return &OverallStatsPublic{