From f61de5645ddac06b86e4bb13bdae2300a2cea379 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 14 Sep 2025 21:16:57 +0300 Subject: [PATCH] Fix: last clue; give clue mime input --- components/room.html | 10 +++++----- models/main.go | 11 ++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/components/room.html b/components/room.html index 76b263b..0183729 100644 --- a/components/room.html +++ b/components/room.html @@ -65,11 +65,11 @@
{{if .Room.IsRunning}} - {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn) (.Room.MimeDone)}} - - {{else if and (eq .State.Role "mime") (not .Room.MimeDone)}} - {{template "mimeclue"}} - {{end}} + {{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn) (.Room.MimeDone)}} + + {{else if and (eq .State.Role "mime") (not .Room.MimeDone) (eq .State.Team .Room.TeamTurn)}} + {{template "mimeclue"}} + {{end}} {{end}}
diff --git a/models/main.go b/models/main.go index ffc78f7..be703e5 100644 --- a/models/main.go +++ b/models/main.go @@ -228,7 +228,16 @@ func (r *Room) FetchLastClue() (*Action, error) { } 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) { return r.ActionHistory[i].Word }