mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Fix bug with free ranking point from fouls not registering.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,6 +24,7 @@ _testmain.go
|
||||
*.exe
|
||||
*.test
|
||||
*.db
|
||||
*.db-journal
|
||||
*.out
|
||||
.DS_Store
|
||||
static/logs
|
||||
|
||||
@@ -47,13 +47,14 @@ var clearFoul = function() {
|
||||
var commitFoul = function() {
|
||||
websocket.send("addFoul", {Alliance: foulTeamButton.attr("data-alliance"),
|
||||
TeamId: parseInt(foulTeamButton.attr("data-team")), Rule: foulRuleButton.attr("data-rule"),
|
||||
IsTechnical: foulRuleButton.attr("data-is-technical") === "true"});
|
||||
IsTechnical: foulRuleButton.attr("data-is-technical") === "true",
|
||||
IsRankingPoint: foulRuleButton.attr("data-is-ranking-point") === "true"});
|
||||
};
|
||||
|
||||
// Removes the foul with the given parameters from the list.
|
||||
var deleteFoul = function(alliance, team, rule, isTechnical, timeSec) {
|
||||
var deleteFoul = function(alliance, team, rule, isTechnical, isRankingPoint, timeSec) {
|
||||
websocket.send("deleteFoul", {Alliance: alliance, TeamId: parseInt(team), Rule: rule,
|
||||
IsTechnical: isTechnical, TimeInMatchSec: timeSec});
|
||||
IsTechnical: isTechnical, IsRankingPoint: isRankingPoint, TimeInMatchSec: timeSec});
|
||||
};
|
||||
|
||||
// Cycles through no card, yellow card, and red card.
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
{{else}}btn-warning{{end}}
|
||||
btn-referee btn-rule"
|
||||
data-rule="{{$rule.RuleNumber}}" data-is-technical="{{$rule.IsTechnical}}"
|
||||
onclick="setFoulRule(this);" data-toggle="tooltip" title="{{$rule.Description}}">
|
||||
data-is-ranking-point="{{$rule.IsRankingPoint}}" onclick="setFoulRule(this);"
|
||||
data-toggle="tooltip" title="{{$rule.Description}}">
|
||||
{{$rule.RuleNumber}}{{if $rule.IsTechnical}}<sup>T</sup>
|
||||
{{else if $rule.IsRankingPoint}}<sup>RP</sup>{{end}}
|
||||
</a>
|
||||
@@ -106,9 +107,11 @@
|
||||
{{define "foul"}}
|
||||
<tr class="row-{{.color}}">
|
||||
<td>{{.foul.TeamId}}</td>
|
||||
<td>{{.foul.RuleNumber}}{{if .foul.IsTechnical}}<sup>T</sup>{{end}}</td>
|
||||
<td>
|
||||
{{.foul.RuleNumber}}{{if .foul.IsTechnical}}<sup>T</sup>{{else if .foul.IsRankingPoint}}<sup>RP</sup>{{end}}
|
||||
</td>
|
||||
<td><a class="btn btn-sm btn-danger" onclick="deleteFoul('{{.color}}', {{.foul.TeamId}}, '{{.foul.RuleNumber}}',
|
||||
{{.foul.IsTechnical}}, {{.foul.TimeInMatchSec}});">Delete</a></td>
|
||||
{{.foul.IsTechnical}}, {{.foul.IsRankingPoint}}, {{.foul.TimeInMatchSec}});">Delete</a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{define "card"}}
|
||||
|
||||
@@ -114,10 +114,11 @@ func (web *Web) refereePanelWebsocketHandler(w http.ResponseWriter, r *http.Requ
|
||||
switch messageType {
|
||||
case "addFoul":
|
||||
args := struct {
|
||||
Alliance string
|
||||
TeamId int
|
||||
Rule string
|
||||
IsTechnical bool
|
||||
Alliance string
|
||||
TeamId int
|
||||
Rule string
|
||||
IsTechnical bool
|
||||
IsRankingPoint bool
|
||||
}{}
|
||||
err = mapstructure.Decode(data, &args)
|
||||
if err != nil {
|
||||
@@ -126,7 +127,8 @@ func (web *Web) refereePanelWebsocketHandler(w http.ResponseWriter, r *http.Requ
|
||||
}
|
||||
|
||||
// Add the foul to the correct alliance's list.
|
||||
foul := game.Foul{Rule: game.Rule{RuleNumber: args.Rule, IsTechnical: args.IsTechnical},
|
||||
foul := game.Foul{Rule: game.Rule{RuleNumber: args.Rule, IsTechnical: args.IsTechnical,
|
||||
IsRankingPoint: args.IsRankingPoint},
|
||||
TeamId: args.TeamId, TimeInMatchSec: web.arena.MatchTimeSec()}
|
||||
if args.Alliance == "red" {
|
||||
web.arena.RedRealtimeScore.CurrentScore.Fouls =
|
||||
@@ -142,6 +144,7 @@ func (web *Web) refereePanelWebsocketHandler(w http.ResponseWriter, r *http.Requ
|
||||
TeamId int
|
||||
Rule string
|
||||
IsTechnical bool
|
||||
IsRankingPoint bool
|
||||
TimeInMatchSec float64
|
||||
}{}
|
||||
err = mapstructure.Decode(data, &args)
|
||||
@@ -151,7 +154,8 @@ func (web *Web) refereePanelWebsocketHandler(w http.ResponseWriter, r *http.Requ
|
||||
}
|
||||
|
||||
// Remove the foul from the correct alliance's list.
|
||||
deleteFoul := game.Foul{Rule: game.Rule{RuleNumber: args.Rule, IsTechnical: args.IsTechnical},
|
||||
deleteFoul := game.Foul{Rule: game.Rule{RuleNumber: args.Rule, IsTechnical: args.IsTechnical,
|
||||
IsRankingPoint: args.IsRankingPoint},
|
||||
TeamId: args.TeamId, TimeInMatchSec: args.TimeInMatchSec}
|
||||
var fouls *[]game.Foul
|
||||
if args.Alliance == "red" {
|
||||
|
||||
Reference in New Issue
Block a user