Fix: last clue; give clue mime input
This commit is contained in:
		| @@ -67,7 +67,7 @@ | ||||
|     {{if .Room.IsRunning}} | ||||
|       {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn) (.Room.MimeDone)}} | ||||
|         <button hx-get="/end-turn" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">End Turn</button> | ||||
|     {{else if and (eq .State.Role "mime") (not .Room.MimeDone)}} | ||||
|       {{else if and (eq .State.Role "mime") (not .Room.MimeDone) (eq .State.Team .Room.TeamTurn)}} | ||||
|         {{template "mimeclue"}} | ||||
|       {{end}} | ||||
|     {{end}} | ||||
|   | ||||
| @@ -228,11 +228,20 @@ func (r *Room) FetchLastClue() (*Action, error) { | ||||
| } | ||||
|  | ||||
| func (r *Room) FetchLastClueWord() string { | ||||
| 	if len(r.ActionHistory) > 1 { | ||||
| 		if strings.EqualFold(r.ActionHistory[0].Action, ActionTypeGameStarted) { | ||||
| 			for i := len(r.ActionHistory) - 1; i >= 0; i-- { | ||||
| 				if r.ActionHistory[i].Action == string(ActionTypeClue) { | ||||
| 					return r.ActionHistory[i].Word | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	for i := 0; i <= len(r.ActionHistory)-1; i++ { | ||||
| 		if r.ActionHistory[i].Action == string(ActionTypeClue) { | ||||
| 			return r.ActionHistory[i].Word | ||||
| 		} | ||||
| 	} | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder