Feat: add backlog
This commit is contained in:
		@@ -66,6 +66,14 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	}
 | 
			
		||||
	fi.Room.RevealSpecificWord(word)
 | 
			
		||||
	fi.Room.UpdateCounter()
 | 
			
		||||
	action := models.Action{
 | 
			
		||||
		Actor:      fi.State.Username,
 | 
			
		||||
		ActorColor: string(fi.State.Team),
 | 
			
		||||
		WordColor:  color,
 | 
			
		||||
		Action:     "guessed",
 | 
			
		||||
		Word:       word,
 | 
			
		||||
	}
 | 
			
		||||
	fi.Room.ActionHistory = append(fi.Room.ActionHistory, action)
 | 
			
		||||
	// if opened card is of color of opp team, change turn
 | 
			
		||||
	switch color {
 | 
			
		||||
	case "black":
 | 
			
		||||
@@ -83,3 +91,17 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	notify(models.NotifyRoomUpdatePrefix+fi.Room.ID, "")
 | 
			
		||||
	tmpl.ExecuteTemplate(w, "cardword", cardword)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func HandleActionHistory(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	fi, err := getFullInfoByCtx(r.Context())
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		abortWithError(w, err.Error())
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	tmpl, err := template.ParseGlob("components/*.html")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		abortWithError(w, err.Error())
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	tmpl.ExecuteTemplate(w, "actionhistory", fi.Room.ActionHistory)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -253,16 +253,19 @@ func HandleGiveClue(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		abortWithError(w, err.Error())
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	action := models.Action{
 | 
			
		||||
		Actor:      fi.State.Username,
 | 
			
		||||
		ActorColor: string(fi.State.Team),
 | 
			
		||||
		WordColor:  string(fi.State.Team),
 | 
			
		||||
		Action:     "gave clue",
 | 
			
		||||
		Word:       clue,
 | 
			
		||||
		Number:     num,
 | 
			
		||||
	}
 | 
			
		||||
	fi.Room.ActionHistory = append(fi.Room.ActionHistory, action)
 | 
			
		||||
	fi.Room.MimeDone = true
 | 
			
		||||
	notify(models.NotifyMimePrefix+fi.Room.ID, clue+num)
 | 
			
		||||
	notify(models.NotifyBacklogPrefix+fi.Room.ID, clue+num)
 | 
			
		||||
	if err := saveFullInfo(fi); err != nil {
 | 
			
		||||
		abortWithError(w, err.Error())
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	// tmpl, err := template.ParseGlob("components/*.html")
 | 
			
		||||
	// if err != nil {
 | 
			
		||||
	// 	abortWithError(w, err.Error())
 | 
			
		||||
	// 	return
 | 
			
		||||
	// }
 | 
			
		||||
	// tmpl.ExecuteTemplate(w, "room", fi)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user