diff --git a/static/js/audience_display.js b/static/js/audience_display.js
index 529332bd..8f330504 100644
--- a/static/js/audience_display.js
+++ b/static/js/audience_display.js
@@ -170,7 +170,7 @@ var handleScorePosted = function(data) {
$("#finalMatchName").text(data.MatchType + " " + data.Match.DisplayName);
// Reload the bracket to reflect any changes.
- $("#bracketSvg").attr("src", "/api/bracket/svg?v=" + new Date().getTime());
+ $("#bracketSvg").attr("src", "/api/bracket/svg?activeMatch=saved&v=" + new Date().getTime());
};
// Handles a websocket message to play a sound to signal match start/stop/etc.
diff --git a/static/js/bracket_display.js b/static/js/bracket_display.js
index ea0b9a59..739a9743 100644
--- a/static/js/bracket_display.js
+++ b/static/js/bracket_display.js
@@ -5,14 +5,14 @@
var websocket;
-// Handles a websocket message to populate the final score data, which also triggers a bracket update.
-const handleScorePosted = function(data) {
- $("#bracketSvg").attr("src", "/api/bracket/svg?v=" + new Date().getTime());
+// Handles a websocket message to load a new match.
+const handleMatchLoad = function(data) {
+ $("#bracketSvg").attr("src", "/api/bracket/svg?activeMatch=current&v=" + new Date().getTime());
};
$(function() {
// Set up the websocket back to the server.
websocket = new CheesyWebsocket("/displays/bracket/websocket", {
- scorePosted: function(event) { handleScorePosted(event.data); },
+ matchLoad: function(event) { handleMatchLoad(event.data); },
});
});
diff --git a/templates/bracket.svg b/templates/bracket.svg
index 83b223de..95346b94 100644
--- a/templates/bracket.svg
+++ b/templates/bracket.svg
@@ -278,146 +278,148 @@
-
-
-
-
- W
- L
+ {{if .ShowTemporaryConnectors}}
+
+
+
+
+ W
+ L
+
+
+
+
+ W
+ L
+
+
+
+
+ W
+ L
+
+
+
+
+ W
+ L
+
+
+
+ W
+ L
+
+
+
+
+ L
+ L
+
+
+
+ W
+ L
+
+
+
+
+ L
+ L
+
+
+
+
+ W
+ L
+
+ W
+ W
+
+
+
+
+
+
+
+
+ W
+ L
+
+
+ W
+ W
+
+
+
+
+
+
+ W
+ W
+ L
+
+
+
+ L
+
+
+
+
+
+ W
+ W
+ L
+
+
+
+ L
+
+
+
+ W
+ L
+
+
+
+ W
+ W
+
+
+
+
+
+
+
+ W
+ W
+ W
+ L
+
+
+
+
+
+
+ W
+ W
+ W
+
+
+
+ W
+ L
+
+ L
+
+
+
+
+
+ W
+ W
+
-
-
-
- W
- L
-
-
-
-
- W
- L
-
-
-
-
- W
- L
-
-
-
- W
- L
-
-
-
-
- L
- L
-
-
-
- W
- L
-
-
-
-
- L
- L
-
-
-
-
- W
- L
-
- W
- W
-
-
-
-
-
-
-
-
- W
- L
-
-
- W
- W
-
-
-
-
-
-
- W
- W
- L
-
-
-
- L
-
-
-
-
-
- W
- W
- L
-
-
-
- L
-
-
-
- W
- L
-
-
-
- W
- W
-
-
-
-
-
-
-
- W
- W
- W
- L
-
-
-
-
-
-
- W
- W
- W
-
-
-
- W
- L
-
- L
-
-
-
-
-
- W
- W
-
-
+ {{end}}
{{else}}
diff --git a/web/api.go b/web/api.go
index 568a719e..92e9f87c 100755
--- a/web/api.go
+++ b/web/api.go
@@ -228,27 +228,29 @@ func (web *Web) teamAvatarsApiHandler(w http.ResponseWriter, r *http.Request) {
}
func (web *Web) bracketSvgApiHandler(w http.ResponseWriter, r *http.Request) {
- hideActive := false
- if hideActiveValue, ok := r.URL.Query()["hideActive"]; ok {
- hideActive = hideActiveValue[0] == "true"
+ var activeMatch *model.Match
+ showTemporaryConnectors := false
+ if activeMatchValue, ok := r.URL.Query()["activeMatch"]; ok {
+ if activeMatchValue[0] == "current" {
+ activeMatch = web.arena.CurrentMatch
+ } else if activeMatchValue[0] == "saved" {
+ activeMatch = web.arena.SavedMatch
+ showTemporaryConnectors = true
+ }
}
w.Header().Set("Content-Type", "image/svg+xml")
- if err := web.generateBracketSvg(w, hideActive); err != nil {
+ if err := web.generateBracketSvg(w, activeMatch, showTemporaryConnectors); err != nil {
handleWebErr(w, err)
return
}
}
-func (web *Web) generateBracketSvg(w io.Writer, hideActive bool) error {
+func (web *Web) generateBracketSvg(w io.Writer, activeMatch *model.Match, showTemporaryConnectors bool) error {
alliances, err := web.arena.Database.GetAllAlliances()
if err != nil {
return err
}
- var activeMatch *model.Match
- if !hideActive {
- activeMatch = web.arena.SavedMatch
- }
matchups := make(map[string]*allianceMatchup)
if web.arena.PlayoffBracket != nil {
@@ -303,8 +305,9 @@ func (web *Web) generateBracketSvg(w io.Writer, hideActive bool) error {
return err
}
data := struct {
- BracketType string
- Matchups map[string]*allianceMatchup
- }{bracketType, matchups}
+ BracketType string
+ Matchups map[string]*allianceMatchup
+ ShowTemporaryConnectors bool
+ }{bracketType, matchups, showTemporaryConnectors}
return template.ExecuteTemplate(w, "bracket", data)
}
diff --git a/web/bracket_display.go b/web/bracket_display.go
index 37a8bf47..c77ddc57 100644
--- a/web/bracket_display.go
+++ b/web/bracket_display.go
@@ -49,5 +49,5 @@ func (web *Web) bracketDisplayWebsocketHandler(w http.ResponseWriter, r *http.Re
defer ws.Close()
// Subscribe the websocket to the notifiers whose messages will be passed on to the client.
- ws.HandleNotifiers(display.Notifier, web.arena.ScorePostedNotifier, web.arena.ReloadDisplaysNotifier)
+ ws.HandleNotifiers(display.Notifier, web.arena.MatchLoadNotifier, web.arena.ReloadDisplaysNotifier)
}
diff --git a/web/reports.go b/web/reports.go
index 69fcfda4..91faad30 100755
--- a/web/reports.go
+++ b/web/reports.go
@@ -681,7 +681,7 @@ func (web *Web) alliancesPdfReportHandler(w http.ResponseWriter, r *http.Request
// suitable Go library for doing so appears to exist).
func (web *Web) bracketPdfReportHandler(w http.ResponseWriter, r *http.Request) {
buffer := new(bytes.Buffer)
- err := web.generateBracketSvg(buffer, true)
+ err := web.generateBracketSvg(buffer, nil, false)
if err != nil {
handleWebErr(w, err)
return