Fix: show-color
This commit is contained in:
		| @@ -61,7 +61,16 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		Color:    color, | 		Color:    color, | ||||||
| 		Revealed: true, | 		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() | 	fi.Room.UpdateCounter() | ||||||
| 	action := models.Action{ | 	action := models.Action{ | ||||||
| 		Actor:      fi.State.Username, | 		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 { | 	for i, card := range r.Cards { | ||||||
| 		if card.Word == word { | 		if card.Word == word { | ||||||
| 			r.Cards[i].Revealed = true | 			r.Cards[i].Revealed = true | ||||||
|  | 			return card.ID | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| type WordCard struct { | type WordCard struct { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder