feat(cmd/joj3): show capped total score [force build]
This commit is contained in:
parent
39b47bc59e
commit
60d9e1b215
|
@ -39,6 +39,7 @@ type Conf struct {
|
|||
Name string `default:"unknown"`
|
||||
LogPath string `default:""`
|
||||
ExpireUnixTimestamp int64 `default:"-1"`
|
||||
MaxTotalScore int `default:"-1"`
|
||||
Stage struct {
|
||||
SandboxExecServer string `default:"localhost:5051"`
|
||||
SandboxToken string `default:""`
|
||||
|
@ -55,7 +56,7 @@ type Conf struct {
|
|||
SkipScoreboard bool `default:"false"`
|
||||
SkipFailedTable bool `default:"false"`
|
||||
SubmitterInIssueTitle bool `default:"true"`
|
||||
MaxTotalScore int `default:"-1"`
|
||||
MaxTotalScore int `default:"-1"` // TODO: remove me
|
||||
}
|
||||
// TODO: remove the following backward compatibility fields
|
||||
SandboxExecServer string `default:"localhost:5051"`
|
||||
|
@ -172,6 +173,9 @@ func ParseConfFile(path string) (conf *Conf, err error) {
|
|||
}
|
||||
env.Attr.ConfName = conf.Name
|
||||
// TODO: remove the following backward compatibility codes
|
||||
if conf.MaxTotalScore < 0 && conf.Teapot.MaxTotalScore >= 0 {
|
||||
conf.MaxTotalScore = conf.Teapot.MaxTotalScore
|
||||
}
|
||||
if len(conf.Stage.Stages) == 0 {
|
||||
conf.Stage.SandboxExecServer = conf.SandboxExecServer
|
||||
conf.Stage.SandboxToken = conf.SandboxToken
|
||||
|
|
|
@ -44,9 +44,14 @@ func mainImpl() (err error) {
|
|||
totalScore += result.Score
|
||||
}
|
||||
}
|
||||
cappedTotalScore := totalScore
|
||||
if confObj.MaxTotalScore >= 0 {
|
||||
cappedTotalScore = min(totalScore, confObj.MaxTotalScore)
|
||||
}
|
||||
slog.Info(
|
||||
"joj3 summary",
|
||||
"totalScore", totalScore,
|
||||
"cappedTotalScore", cappedTotalScore,
|
||||
"forceQuit", forceQuitStageName != "",
|
||||
"forceQuitStageName", forceQuitStageName,
|
||||
"issue", teapotResult.Issue,
|
||||
|
|
|
@ -59,7 +59,7 @@ func Run(conf *conf.Conf) (teapotResult TeapotResult, err error) {
|
|||
env.Attr.RunNumber, conf.Teapot.ScoreboardPath,
|
||||
conf.Teapot.FailedTablePath,
|
||||
conf.Name, env.Attr.Sha, env.Attr.RunID,
|
||||
"--max-total-score", strconv.Itoa(conf.Teapot.MaxTotalScore),
|
||||
"--max-total-score", strconv.Itoa(conf.MaxTotalScore),
|
||||
skipIssueArg, skipScoreboardArg,
|
||||
skipFailedTableArg, submitterInIssueTitleArg,
|
||||
) // #nosec G204
|
||||
|
|
Loading…
Reference in New Issue
Block a user