Fix: last clue; give clue mime input
This commit is contained in:
		| @@ -65,11 +65,11 @@ | |||||||
|   </div>  |   </div>  | ||||||
|   <div> |   <div> | ||||||
|     {{if .Room.IsRunning}} |     {{if .Room.IsRunning}} | ||||||
|     {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn) (.Room.MimeDone)}} |       {{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> |         <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"}} |         {{template "mimeclue"}} | ||||||
|     {{end}} |       {{end}} | ||||||
|     {{end}} |     {{end}} | ||||||
|   </div> |   </div> | ||||||
|   <div> |   <div> | ||||||
|   | |||||||
| @@ -228,7 +228,16 @@ func (r *Room) FetchLastClue() (*Action, error) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (r *Room) FetchLastClueWord() string { | func (r *Room) FetchLastClueWord() string { | ||||||
| 	for i := len(r.ActionHistory) - 1; i >= 0; i-- { | 	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) { | 		if r.ActionHistory[i].Action == string(ActionTypeClue) { | ||||||
| 			return r.ActionHistory[i].Word | 			return r.ActionHistory[i].Word | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder