From 9ec017d30d35736bd61f60478a75e0dd4de0f9e7 Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 16 Jan 2025 10:15:55 -0600 Subject: [PATCH] error with string to decimal formatting --- backend/routes/canvas.go | 6 +++--- backend/routes/indexer/nft.go | 2 +- backend/routes/indexer/pixel.go | 4 ++-- backend/routes/pixel.go | 4 ++-- backend/video/video.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/routes/canvas.go b/backend/routes/canvas.go index a3294d1d..acc0b11a 100644 --- a/backend/routes/canvas.go +++ b/backend/routes/canvas.go @@ -21,7 +21,7 @@ func initCanvas(w http.ResponseWriter, r *http.Request) { } roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) if core.ArtPeaceBackend.Databases.Redis.Exists(context.Background(), canvasKey).Val() == 0 { totalBitSize := core.ArtPeaceBackend.CanvasConfig.Canvas.Width * core.ArtPeaceBackend.CanvasConfig.Canvas.Height * core.ArtPeaceBackend.CanvasConfig.ColorsBitWidth @@ -40,9 +40,9 @@ func initCanvas(w http.ResponseWriter, r *http.Request) { return } - routeutils.WriteResultJson(w, fmt.Sprintf("Canvas for round %d initialized", roundNumber)) + routeutils.WriteResultJson(w, fmt.Sprintf("Canvas for round %s initialized", roundNumber)) } else { - routeutils.WriteErrorJson(w, http.StatusConflict, fmt.Sprintf("Canvas for round %d already initialized", roundNumber)) + routeutils.WriteErrorJson(w, http.StatusConflict, fmt.Sprintf("Canvas for round %s already initialized", roundNumber)) } } diff --git a/backend/routes/indexer/nft.go b/backend/routes/indexer/nft.go index d3626fd8..ad76ad82 100644 --- a/backend/routes/indexer/nft.go +++ b/backend/routes/indexer/nft.go @@ -91,7 +91,7 @@ func processNFTMintedEvent(event IndexerEvent) { // Load image from redis ctx := context.Background() roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) canvas, err := core.ArtPeaceBackend.Databases.Redis.Get(ctx, canvasKey).Result() if err != nil { PrintIndexerError("processNFTMintedEvent", "Error getting canvas from redis", tokenIdLowHex, tokenIdHighHex, positionHex, widthHex, heightHex, nameHex, imageHashHex, blockNumberHex, minter) diff --git a/backend/routes/indexer/pixel.go b/backend/routes/indexer/pixel.go index 51ebedf2..018f5f37 100644 --- a/backend/routes/indexer/pixel.go +++ b/backend/routes/indexer/pixel.go @@ -48,7 +48,7 @@ func processPixelPlacedEvent(event IndexerEvent) { ctx := context.Background() roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) err = core.ArtPeaceBackend.Databases.Redis.BitField(ctx, canvasKey, "SET", bitfieldType, pos, color).Err() if err != nil { PrintIndexerError("processPixelPlacedEvent", "Error setting pixel in redis", address, posHex, dayIdxHex, colorHex) @@ -102,7 +102,7 @@ func revertPixelPlacedEvent(event IndexerEvent) { ctx := context.Background() roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) err = core.ArtPeaceBackend.Databases.Redis.BitField(ctx, canvasKey, "SET", bitfieldType, pos, oldColor).Err() if err != nil { PrintIndexerError("revertPixelPlacedEvent", "Error resetting pixel in redis", address, posHex) diff --git a/backend/routes/pixel.go b/backend/routes/pixel.go index 6b2bcd06..d4f10d4a 100644 --- a/backend/routes/pixel.go +++ b/backend/routes/pixel.go @@ -41,7 +41,7 @@ func getPixel(w http.ResponseWriter, r *http.Request) { ctx := context.Background() roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) val, err := core.ArtPeaceBackend.Databases.Redis.BitField(ctx, canvasKey, "GET", bitfieldType, pos).Result() if err != nil { routeutils.WriteErrorJson(w, http.StatusInternalServerError, "Error getting pixel") @@ -219,7 +219,7 @@ func placePixelRedis(w http.ResponseWriter, r *http.Request) { ctx := context.Background() roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) err = core.ArtPeaceBackend.Databases.Redis.BitField(ctx, canvasKey, "SET", bitfieldType, pos, color).Err() if err != nil { routeutils.WriteErrorJson(w, http.StatusInternalServerError, "Error setting pixel on redis") diff --git a/backend/video/video.go b/backend/video/video.go index b18da185..bac2dc83 100644 --- a/backend/video/video.go +++ b/backend/video/video.go @@ -43,7 +43,7 @@ func GenerateImageFromCanvas(orderId int) { generatedImage := image.NewRGBA(image.Rect(0, 0, canvasWidth, canvasHeight)) bitfieldType := "u" + strconv.Itoa(int(core.ArtPeaceBackend.CanvasConfig.ColorsBitWidth)) roundNumber := core.ArtPeaceBackend.CanvasConfig.Round - canvasKey := fmt.Sprintf("canvas-%d", roundNumber) + canvasKey := fmt.Sprintf("canvas-%s", roundNumber) for y := 0; y < canvasHeight; y++ { for x := 0; x < canvasWidth; x++ { position := y*canvasWidth + x