diff --git a/.gitignore b/.gitignore index 616fe9b..a66230a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ _testmain.go *.exe *.test *.db +*.db-journal *.out .DS_Store static/logs diff --git a/static/js/referee_panel.js b/static/js/referee_panel.js index 27cf820..4b4f5d1 100644 --- a/static/js/referee_panel.js +++ b/static/js/referee_panel.js @@ -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. diff --git a/templates/referee_panel.html b/templates/referee_panel.html index 9618abc..91a1391 100644 --- a/templates/referee_panel.html +++ b/templates/referee_panel.html @@ -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}}T {{else if $rule.IsRankingPoint}}RP{{end}} @@ -106,9 +107,11 @@ {{define "foul"}} {{.foul.TeamId}} - {{.foul.RuleNumber}}{{if .foul.IsTechnical}}T{{end}} + + {{.foul.RuleNumber}}{{if .foul.IsTechnical}}T{{else if .foul.IsRankingPoint}}RP{{end}} + Delete + {{.foul.IsTechnical}}, {{.foul.IsRankingPoint}}, {{.foul.TimeInMatchSec}});">Delete {{end}} {{define "card"}} diff --git a/web/referee_panel.go b/web/referee_panel.go index 82b3e42..6985212 100644 --- a/web/referee_panel.go +++ b/web/referee_panel.go @@ -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" {