Skip to content

Commit

Permalink
error with string to decimal formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-roberts committed Jan 16, 2025
1 parent c811d6a commit 9ec017d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions backend/routes/canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion backend/routes/indexer/nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions backend/routes/indexer/pixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions backend/routes/pixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion backend/video/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ec017d

Please sign in to comment.