From 88b6ac04486ba346f94c7e09f07fc31eb1a69f7c Mon Sep 17 00:00:00 2001 From: Vuong <3168632+vuon9@users.noreply.github.com> Date: Wed, 17 Nov 2021 21:37:51 +0700 Subject: [PATCH] Fix #297 CMC Coin ID --- cointop/coin.go | 7 ++++--- pkg/api/impl/coinmarketcap/coinmarketcap.go | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cointop/coin.go b/cointop/coin.go index 8d2526e..f9af89e 100644 --- a/cointop/coin.go +++ b/cointop/coin.go @@ -1,7 +1,7 @@ package cointop import ( - "errors" + "fmt" log "github.com/sirupsen/logrus" ) @@ -108,8 +108,9 @@ func (ct *Cointop) UpdateCoin(coin *Coin) error { k, found := ct.State.allCoinsSlugMap.Load(coin.Name) if !found { - log.Debugf("UpdateCoin() could not found coin %s in the slug map", coin.Name) - return errors.New("could not find coin index in allCoinsSlugMap") + err := fmt.Errorf("UpdateCoin() could not find coin %s in the slug map", coin.Name) + log.Debug(err.Error()) + return err } coin = &Coin{ diff --git a/pkg/api/impl/coinmarketcap/coinmarketcap.go b/pkg/api/impl/coinmarketcap/coinmarketcap.go index 0aa28bd..96ba3af 100644 --- a/pkg/api/impl/coinmarketcap/coinmarketcap.go +++ b/pkg/api/impl/coinmarketcap/coinmarketcap.go @@ -77,8 +77,7 @@ func (s *Service) getPaginatedCoinData(convert string, offset int) ([]apitypes.C } ret = append(ret, apitypes.Coin{ - // TODO: Fix ID - ID: util.FormatID(v.Name), + ID: util.FormatID(fmt.Sprint(v.ID)), Name: util.FormatName(v.Name), Symbol: util.FormatSymbol(v.Symbol), Rank: util.FormatRank(v.CMCRank),