Simpify scoring model and fix RungIsLevel bonus logic.

This commit is contained in:
Patrick Fairbank
2020-03-21 12:41:01 -07:00
parent a32d0c78b2
commit 712d739290
13 changed files with 135 additions and 106 deletions

View File

@@ -95,13 +95,13 @@ func (database *Database) TruncateMatchResults() error {
}
// Calculates and returns the summary fields used for ranking and display for the red alliance.
func (matchResult *MatchResult) RedScoreSummary() *game.ScoreSummary {
return matchResult.RedScore.Summarize(matchResult.BlueScore.Fouls)
func (matchResult *MatchResult) RedScoreSummary(teleopStarted bool) *game.ScoreSummary {
return matchResult.RedScore.Summarize(matchResult.BlueScore.Fouls, teleopStarted)
}
// Calculates and returns the summary fields used for ranking and display for the blue alliance.
func (matchResult *MatchResult) BlueScoreSummary() *game.ScoreSummary {
return matchResult.BlueScore.Summarize(matchResult.RedScore.Fouls)
func (matchResult *MatchResult) BlueScoreSummary(teleopStarted bool) *game.ScoreSummary {
return matchResult.BlueScore.Summarize(matchResult.RedScore.Fouls, teleopStarted)
}
// Checks the score for disqualifications or a tie and adjusts it appropriately.

View File

@@ -26,7 +26,7 @@ func TestMatchResultCrud(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, matchResult, matchResult2)
matchResult.BlueScore.EndgameStatuses = [3]game.EndgameStatus{game.Hang, game.None, game.Park}
matchResult.BlueScore.EndgameStatuses = [3]game.EndgameStatus{game.EndgameHang, game.EndgameNone, game.EndgamePark}
db.SaveMatchResult(matchResult)
matchResult2, err = db.GetMatchResultForMatch(254)
assert.Nil(t, err)