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