Skip to content

Commit

Permalink
feat:CheckRainbowStatus (#239)
Browse files Browse the repository at this point in the history
* feat:CheckRainbowStatus

* Patch rainbow quest status impl

---------

Co-authored-by: Brandon Roberts <[email protected]>
  • Loading branch information
lfgtwo and b-j-roberts authored Jun 21, 2024
1 parent f457eca commit 9540b7f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions backend/quests/status.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package quests

import "github.com/keep-starknet-strange/art-peace/backend/core"
import (
"github.com/keep-starknet-strange/art-peace/backend/core"
)

var QuestChecks = map[int]func(*Quest, string) (int, int){
AuthorityQuestType: CheckAuthorityStatus,
Expand Down Expand Up @@ -97,9 +99,18 @@ func CheckFactionStatus(q *Quest, user string) (progress int, needed int) {
return *count, 1
}

type RainbowStatus struct {
Used int `json:"used"`
Colors int `json:"colors"`
}

func CheckRainbowStatus(q *Quest, user string) (progress int, needed int) {
// TODO: Implement this
return 0, 1
status, err := core.PostgresQueryOne[RainbowStatus]("SELECT COUNT(DISTINCT p.color) as used, (SELECT COUNT(*) FROM Colors) as colors FROM Pixels p WHERE p.address = $1", user)
if err != nil {
return 0, 1
}

return status.Used, status.Colors
}

func CheckTemplateStatus(q *Quest, user string) (progress int, needed int) {
Expand Down

0 comments on commit 9540b7f

Please sign in to comment.