Add Plc.IsEnabled() method and refactor places that were checking settings directly to use it instead.

This commit is contained in:
Patrick Fairbank
2020-03-22 17:42:37 -07:00
parent 27dc4a8773
commit 31505b265f
7 changed files with 18 additions and 11 deletions

View File

@@ -71,12 +71,13 @@ func (web *Web) matchPlayHandler(w http.ResponseWriter, r *http.Request) {
isReplay := matchResult != nil
data := struct {
*model.EventSettings
PlcIsEnabled bool
MatchesByType map[string]MatchPlayList
CurrentMatchType string
Match *model.Match
AllowSubstitution bool
IsReplay bool
}{web.arena.EventSettings, matchesByType, currentMatchType, web.arena.CurrentMatch,
}{web.arena.EventSettings, web.arena.Plc.IsEnabled(), matchesByType, currentMatchType, web.arena.CurrentMatch,
web.arena.CurrentMatch.ShouldAllowSubstitution(), isReplay}
err = template.ExecuteTemplate(w, "base", data)
if err != nil {