Give scorekeeper ability to signal field reset and volunteers.

This commit is contained in:
Patrick Fairbank
2022-07-24 14:36:44 -07:00
parent 915351df8f
commit c78c5323bb
4 changed files with 57 additions and 4 deletions

View File

@@ -112,4 +112,11 @@ input[data-changed="true"], select[data-changed="true"] {
padding: 5px;
border-radius: 3px;
border: 1px solid #ddd;
}
}
.status-well {
margin-bottom: 10px;
}
#buttonBottomRow {
margin-top: 5px;
margin-bottom: 10px;
}

View File

@@ -28,6 +28,16 @@ var abortMatch = function() {
websocket.send("abortMatch");
};
// Sends a websocket message to signal to the volunteers that they may enter the field.
var signalVolunteers = function() {
websocket.send("signalVolunteers");
};
// Sends a websocket message to signal to the teams that they may enter the field.
var signalReset = function() {
websocket.send("signalReset");
};
// Sends a websocket message to commit the match score and load the next match.
var commitResults = function() {
websocket.send("commitResults");
@@ -153,6 +163,8 @@ var handleArenaStatus = function(data) {
case "PRE_MATCH":
$("#startMatch").prop("disabled", !data.CanStartMatch);
$("#abortMatch").prop("disabled", true);
$("#signalVolunteers").prop("disabled", true);
$("#signalReset").prop("disabled", true);
$("#commitResults").prop("disabled", true);
$("#discardResults").prop("disabled", true);
$("#editResults").prop("disabled", true);
@@ -177,6 +189,8 @@ var handleArenaStatus = function(data) {
case "TELEOP_PERIOD":
$("#startMatch").prop("disabled", true);
$("#abortMatch").prop("disabled", false);
$("#signalVolunteers").prop("disabled", true);
$("#signalReset").prop("disabled", true);
$("#commitResults").prop("disabled", true);
$("#discardResults").prop("disabled", true);
$("#editResults").prop("disabled", true);
@@ -191,6 +205,8 @@ var handleArenaStatus = function(data) {
case "POST_MATCH":
$("#startMatch").prop("disabled", true);
$("#abortMatch").prop("disabled", true);
$("#signalVolunteers").prop("disabled", false);
$("#signalReset").prop("disabled", false);
$("#commitResults").prop("disabled", false);
$("#discardResults").prop("disabled", false);
$("#editResults").prop("disabled", false);
@@ -205,6 +221,8 @@ var handleArenaStatus = function(data) {
case "TIMEOUT_ACTIVE":
$("#startMatch").prop("disabled", true);
$("#abortMatch").prop("disabled", false);
$("#signalVolunteers").prop("disabled", true);
$("#signalReset").prop("disabled", true);
$("#commitResults").prop("disabled", true);
$("#discardResults").prop("disabled", true);
$("#editResults").prop("disabled", true);
@@ -219,6 +237,8 @@ var handleArenaStatus = function(data) {
case "POST_TIMEOUT":
$("#startMatch").prop("disabled", true);
$("#abortMatch").prop("disabled", true);
$("#signalVolunteers").prop("disabled", true);
$("#signalReset").prop("disabled", true);
$("#commitResults").prop("disabled", true);
$("#discardResults").prop("disabled", true);
$("#editResults").prop("disabled", true);

View File

@@ -62,7 +62,7 @@
<div id="blueScore" class="col-lg-2 well well-sm well-blue text-center">&nbsp;</div>
</div>
<div class="row text-center">
<div class="col-lg-6 well well-darkblue">
<div class="col-lg-6 well well-darkblue status-well">
<div class="row form-group">
<div class="col-lg-4">Blue Teams</div>
<div class="col-lg-2" data-toggle="tooltip" title="Driver Station">DS</div>
@@ -74,7 +74,7 @@
{{template "matchPlayTeam" dict "team" .Match.Blue2 "color" "B" "position" 2 "data" .}}
{{template "matchPlayTeam" dict "team" .Match.Blue3 "color" "B" "position" 3 "data" .}}
</div>
<div class="col-lg-6 well well-darkred">
<div class="col-lg-6 well well-darkred status-well">
<div class="row form-group">
<div class="col-lg-4">Red Teams</div>
<div class="col-lg-2" data-toggle="tooltip" title="Driver Station">DS</div>
@@ -96,6 +96,16 @@
onclick="abortMatch();" disabled>
Abort Match
</button>
<button type="button" id="signalVolunteers" class="btn btn-warning btn-lg btn-match-play"
onclick="signalVolunteers();" disabled>
Signal Volunteers
</button>
<button type="button" id="signalReset" class="btn btn-success btn-lg btn-match-play"
onclick="signalReset();" disabled>
Signal Reset
</button>
</div>
<div id="buttonBottomRow" class="row text-center">
<button type="button" id="commitResults" class="btn btn-info btn-lg btn-match-play"
onclick="confirmCommit({{.IsReplay}});" disabled>
Commit Results
@@ -110,7 +120,6 @@
</button>
</a>
</div>
<br />
<div class="row">
<div class="col-lg-12 well">
<div class="col-lg-3">

View File

@@ -7,6 +7,7 @@ package web
import (
"fmt"
"github.com/Team254/cheesy-arena-lite/field"
"github.com/Team254/cheesy-arena-lite/game"
"github.com/Team254/cheesy-arena-lite/model"
"github.com/Team254/cheesy-arena-lite/tournament"
@@ -243,6 +244,22 @@ func (web *Web) matchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request
ws.WriteError(err.Error())
continue
}
case "signalVolunteers":
if web.arena.MatchState != field.PostMatch {
// Don't allow clearing the field until the match is over.
continue
}
web.arena.FieldVolunteers = true
continue // Don't reload.
case "signalReset":
if web.arena.MatchState != field.PostMatch {
// Don't allow clearing the field until the match is over.
continue
}
web.arena.FieldReset = true
web.arena.AllianceStationDisplayMode = "fieldReset"
web.arena.AllianceStationDisplayModeNotifier.Notify()
continue // Don't reload.
case "commitResults":
err = web.commitCurrentMatchScore()
if err != nil {