mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Remove pre-match scoring enforcement since it's not needed for 2020.
This commit is contained in:
@@ -68,7 +68,6 @@ type Arena struct {
|
||||
AllianceStationDisplayMode string
|
||||
AllianceSelectionAlliances [][]model.AllianceTeam
|
||||
LowerThird *model.LowerThird
|
||||
BypassPreMatchScore bool
|
||||
MuteMatchSounds bool
|
||||
matchAborted bool
|
||||
soundsPlayed map[*game.MatchSound]struct{}
|
||||
@@ -338,7 +337,6 @@ func (arena *Arena) ResetMatch() error {
|
||||
arena.AllianceStations["B1"].Bypass = false
|
||||
arena.AllianceStations["B2"].Bypass = false
|
||||
arena.AllianceStations["B3"].Bypass = false
|
||||
arena.BypassPreMatchScore = false
|
||||
arena.MuteMatchSounds = false
|
||||
return nil
|
||||
}
|
||||
@@ -640,10 +638,6 @@ func (arena *Arena) checkCanStartMatch() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !arena.BypassPreMatchScore {
|
||||
return fmt.Errorf("Cannot start match until pre-match scoring is set")
|
||||
}
|
||||
|
||||
if arena.EventSettings.PlcAddress != "" {
|
||||
if !arena.Plc.IsHealthy {
|
||||
return fmt.Errorf("Cannot start match while PLC is not healthy.")
|
||||
@@ -735,11 +729,9 @@ func (arena *Arena) handlePlcOutput() {
|
||||
// not input, or blinking green if ready.
|
||||
redAllianceReady := arena.checkAllianceStationsReady("R1", "R2", "R3") == nil
|
||||
blueAllianceReady := arena.checkAllianceStationsReady("B1", "B2", "B3") == nil
|
||||
preMatchScoreReady := arena.BypassPreMatchScore
|
||||
greenStackLight := redAllianceReady && blueAllianceReady && preMatchScoreReady &&
|
||||
arena.Plc.GetCycleState(2, 0, 2)
|
||||
arena.Plc.SetStackLights(!redAllianceReady, !blueAllianceReady, !preMatchScoreReady, greenStackLight)
|
||||
arena.Plc.SetStackBuzzer(redAllianceReady && blueAllianceReady && preMatchScoreReady)
|
||||
greenStackLight := redAllianceReady && blueAllianceReady && arena.Plc.GetCycleState(2, 0, 2)
|
||||
arena.Plc.SetStackLights(!redAllianceReady, !blueAllianceReady, false, greenStackLight)
|
||||
arena.Plc.SetStackBuzzer(redAllianceReady && blueAllianceReady)
|
||||
|
||||
// Turn off lights if all teams become ready.
|
||||
if redAllianceReady && blueAllianceReady {
|
||||
|
||||
@@ -42,9 +42,8 @@ type MatchTimeMessage struct {
|
||||
}
|
||||
|
||||
type audienceAllianceScoreFields struct {
|
||||
Score *game.Score
|
||||
ScoreSummary *game.ScoreSummary
|
||||
IsPreMatchScoreReady bool
|
||||
Score *game.Score
|
||||
ScoreSummary *game.ScoreSummary
|
||||
}
|
||||
|
||||
// Instantiates notifiers and configures their message producing methods.
|
||||
@@ -92,11 +91,10 @@ func (arena *Arena) generateArenaStatusMessage() interface{} {
|
||||
AllianceStations map[string]*AllianceStation
|
||||
TeamWifiStatuses map[string]network.TeamWifiStatus
|
||||
MatchState
|
||||
BypassPreMatchScore bool
|
||||
CanStartMatch bool
|
||||
PlcIsHealthy bool
|
||||
FieldEstop bool
|
||||
}{arena.CurrentMatch.Id, arena.AllianceStations, teamWifiStatuses, arena.MatchState, arena.BypassPreMatchScore,
|
||||
CanStartMatch bool
|
||||
PlcIsHealthy bool
|
||||
FieldEstop bool
|
||||
}{arena.CurrentMatch.Id, arena.AllianceStations, teamWifiStatuses, arena.MatchState,
|
||||
arena.checkCanStartMatch() == nil, arena.Plc.IsHealthy, arena.Plc.GetFieldEstop()}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,13 +70,6 @@ func TestArenaCheckCanStartMatch(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "Cannot start match until all robots are connected or bypassed")
|
||||
}
|
||||
arena.AllianceStations["B3"].Bypass = true
|
||||
err = arena.checkCanStartMatch()
|
||||
if assert.NotNil(t, err) {
|
||||
assert.Contains(t, err.Error(), "Cannot start match until pre-match scoring is set")
|
||||
}
|
||||
|
||||
// Check scoring constraints.
|
||||
arena.BypassPreMatchScore = true
|
||||
assert.Nil(t, arena.checkCanStartMatch())
|
||||
|
||||
// Check PLC constraints.
|
||||
@@ -119,7 +112,6 @@ func TestArenaMatchFlow(t *testing.T) {
|
||||
arena.AllianceStations["B1"].Bypass = true
|
||||
arena.AllianceStations["B2"].Bypass = true
|
||||
arena.AllianceStations["B3"].DsConn.RobotLinked = true
|
||||
arena.BypassPreMatchScore = true
|
||||
err = arena.StartMatch()
|
||||
assert.Nil(t, err)
|
||||
arena.Update()
|
||||
@@ -218,7 +210,6 @@ func TestArenaStateEnforcement(t *testing.T) {
|
||||
arena.AllianceStations["B1"].Bypass = true
|
||||
arena.AllianceStations["B2"].Bypass = true
|
||||
arena.AllianceStations["B3"].Bypass = true
|
||||
arena.BypassPreMatchScore = true
|
||||
|
||||
err := arena.LoadMatch(new(model.Match))
|
||||
assert.Nil(t, err)
|
||||
@@ -325,7 +316,6 @@ func TestMatchStartRobotLinkEnforcement(t *testing.T) {
|
||||
for _, station := range arena.AllianceStations {
|
||||
station.DsConn.RobotLinked = true
|
||||
}
|
||||
arena.BypassPreMatchScore = true
|
||||
err = arena.StartMatch()
|
||||
assert.Nil(t, err)
|
||||
arena.MatchState = PreMatch
|
||||
@@ -499,7 +489,6 @@ func TestAstop(t *testing.T) {
|
||||
arena.AllianceStations["B1"].Bypass = true
|
||||
arena.AllianceStations["B2"].Bypass = true
|
||||
arena.AllianceStations["B3"].Bypass = true
|
||||
arena.BypassPreMatchScore = true
|
||||
err = arena.StartMatch()
|
||||
assert.Nil(t, err)
|
||||
arena.Update()
|
||||
@@ -605,7 +594,6 @@ func TestArenaTimeout(t *testing.T) {
|
||||
arena.AllianceStations["B1"].Bypass = true
|
||||
arena.AllianceStations["B2"].Bypass = true
|
||||
arena.AllianceStations["B3"].Bypass = true
|
||||
arena.BypassPreMatchScore = true
|
||||
assert.Nil(t, arena.StartMatch())
|
||||
arena.Update()
|
||||
assert.NotNil(t, arena.StartTimeout(1))
|
||||
@@ -642,7 +630,6 @@ func TestSaveTeamHasConnected(t *testing.T) {
|
||||
arena.AllianceStations["B2"].DsConn = &DriverStationConnection{TeamId: 105, RobotLinked: true}
|
||||
arena.AllianceStations["B3"].DsConn = &DriverStationConnection{TeamId: 106, RobotLinked: true}
|
||||
arena.AllianceStations["B3"].Team.City = "Sand Hosay" // Change some other field to verify that it isn't saved.
|
||||
arena.BypassPreMatchScore = true
|
||||
assert.Nil(t, arena.StartMatch())
|
||||
|
||||
// Check that the connection status was saved for the teams that just linked for the first time.
|
||||
|
||||
@@ -18,11 +18,6 @@ var toggleBypass = function(station) {
|
||||
websocket.send("toggleBypass", station);
|
||||
};
|
||||
|
||||
// Sends a websocket message to toggle the bypass state for the pre-match scoring.
|
||||
var toggleBypassPreMatchScore = function() {
|
||||
websocket.send("toggleBypassPreMatchScore");
|
||||
};
|
||||
|
||||
// Sends a websocket message to start the match.
|
||||
var startMatch = function() {
|
||||
websocket.send("startMatch",
|
||||
@@ -184,8 +179,6 @@ var handleArenaStatus = function(data) {
|
||||
break;
|
||||
}
|
||||
|
||||
$("#bypassPreMatchScore").prop("checked", data.BypassPreMatchScore);
|
||||
|
||||
if (data.PlcIsHealthy) {
|
||||
$("#plcStatus").text("Connected");
|
||||
$("#plcStatus").attr("data-ready", true);
|
||||
@@ -208,10 +201,6 @@ var handleMatchTime = function(data) {
|
||||
var handleRealtimeScore = function(data) {
|
||||
$("#redScore").text(data.Red.ScoreSummary.Score);
|
||||
$("#blueScore").text(data.Blue.ScoreSummary.Score);
|
||||
if (matchStates[data.MatchState] == "PRE_MATCH") {
|
||||
$("#redPreMatchScoreStatus").attr("data-ready", data.Red.IsPreMatchScoreReady);
|
||||
$("#bluePreMatchScoreStatus").attr("data-ready", data.Blue.IsPreMatchScoreReady);
|
||||
}
|
||||
};
|
||||
|
||||
// Handles a websocket message to update the audience display screen selector.
|
||||
|
||||
@@ -112,15 +112,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12 well">
|
||||
<div class="col-lg-3">
|
||||
<p>Pre-Match Scoring</p>
|
||||
<p><span class="label label-scoring" id="redPreMatchScoreStatus">Red Scoring</span><br />
|
||||
<span class="label label-scoring" id="bluePreMatchScoreStatus">Blue Scoring</span></p>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="bypassPreMatchScore" onchange="toggleBypassPreMatchScore();">Bypass
|
||||
</label>
|
||||
</div>
|
||||
<p>Post-Match Scoring</p>
|
||||
<p>Scoring</p>
|
||||
<p><span class="label label-scoring" id="refereeScoreStatus">Referee</span><br />
|
||||
<span class="label label-scoring" id="redScoreStatus"></span><br />
|
||||
<span class="label label-scoring" id="blueScoreStatus"></span></p>
|
||||
|
||||
@@ -58,7 +58,6 @@ func TestAllianceStationDisplayWebsocket(t *testing.T) {
|
||||
web.arena.AllianceStations["B1"].Bypass = true
|
||||
web.arena.AllianceStations["B2"].Bypass = true
|
||||
web.arena.AllianceStations["B3"].Bypass = true
|
||||
web.arena.BypassPreMatchScore = true
|
||||
web.arena.StartMatch()
|
||||
web.arena.Update()
|
||||
messages := readWebsocketMultiple(t, ws, 3)
|
||||
|
||||
@@ -45,7 +45,6 @@ func TestAnnouncerDisplayWebsocket(t *testing.T) {
|
||||
web.arena.AllianceStations["B1"].Bypass = true
|
||||
web.arena.AllianceStations["B2"].Bypass = true
|
||||
web.arena.AllianceStations["B3"].Bypass = true
|
||||
web.arena.BypassPreMatchScore = true
|
||||
web.arena.StartMatch()
|
||||
web.arena.Update()
|
||||
messages := readWebsocketMultiple(t, ws, 2)
|
||||
|
||||
@@ -55,7 +55,6 @@ func TestAudienceDisplayWebsocket(t *testing.T) {
|
||||
web.arena.AllianceStations["B1"].Bypass = true
|
||||
web.arena.AllianceStations["B2"].Bypass = true
|
||||
web.arena.AllianceStations["B3"].Bypass = true
|
||||
web.arena.BypassPreMatchScore = true
|
||||
web.arena.StartMatch()
|
||||
web.arena.Update()
|
||||
web.arena.Update()
|
||||
|
||||
@@ -207,8 +207,6 @@ func (web *Web) matchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request
|
||||
continue
|
||||
}
|
||||
web.arena.AllianceStations[station].Bypass = !web.arena.AllianceStations[station].Bypass
|
||||
case "toggleBypassPreMatchScore":
|
||||
web.arena.BypassPreMatchScore = !web.arena.BypassPreMatchScore
|
||||
case "startMatch":
|
||||
args := struct {
|
||||
MuteMatchSounds bool
|
||||
|
||||
@@ -296,7 +296,6 @@ func TestMatchPlayWebsocketCommands(t *testing.T) {
|
||||
web.arena.AllianceStations["B1"].Bypass = true
|
||||
web.arena.AllianceStations["B2"].Bypass = true
|
||||
web.arena.AllianceStations["B3"].Bypass = true
|
||||
web.arena.BypassPreMatchScore = true
|
||||
ws.Write("startMatch", nil)
|
||||
readWebsocketType(t, ws, "arenaStatus")
|
||||
assert.Equal(t, field.StartMatch, web.arena.MatchState)
|
||||
@@ -356,7 +355,6 @@ func TestMatchPlayWebsocketNotifications(t *testing.T) {
|
||||
web.arena.AllianceStations["B1"].Bypass = true
|
||||
web.arena.AllianceStations["B2"].Bypass = true
|
||||
web.arena.AllianceStations["B3"].Bypass = true
|
||||
web.arena.BypassPreMatchScore = true
|
||||
assert.Nil(t, web.arena.StartMatch())
|
||||
web.arena.Update()
|
||||
messages := readWebsocketMultiple(t, ws, 4)
|
||||
|
||||
Reference in New Issue
Block a user