Fix: show-color
This commit is contained in:
		| @@ -61,7 +61,16 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 		Color:    color, | ||||
| 		Revealed: true, | ||||
| 	} | ||||
| 	fi.Room.RevealSpecificWord(word) | ||||
| 	revCardID := fi.Room.RevealSpecificWord(word) | ||||
| 	if revCardID == 0 { | ||||
| 		// error | ||||
| 		abortWithError(w, "word has 0 id") | ||||
| 		return | ||||
| 	} | ||||
| 	if err := repo.WordCardReveal(r.Context(), word, fi.Room.ID); err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	fi.Room.UpdateCounter() | ||||
| 	action := models.Action{ | ||||
| 		Actor:      fi.State.Username, | ||||
|   | ||||
| @@ -376,12 +376,14 @@ func (r *Room) GuesserView() { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (r *Room) RevealSpecificWord(word string) { | ||||
| func (r *Room) RevealSpecificWord(word string) uint32 { | ||||
| 	for i, card := range r.Cards { | ||||
| 		if card.Word == word { | ||||
| 			r.Cards[i].Revealed = true | ||||
| 			return card.ID | ||||
| 		} | ||||
| 	} | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| type WordCard struct { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder