feat: score & comment conf in result-status and dummy parser
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									92c35f92fc
								
							
						
					
					
						commit
						175685c074
					
				|  | @ -1 +1 @@ | ||||||
| Subproject commit af990327ab095c22a383448ad70d915f8d10490b | Subproject commit 4d0d2bfdf8d2998f77b105d9d376ad52f3279fff | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit ac7a2fc912fb51af156cd4babb7e72148ebe1c14 | Subproject commit ce71d96228ce42703278ff271356867994f6cb20 | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 36bb5fb15f100078bd3af1027017825932f8c24b | Subproject commit d303867e62383755b963fb7a519631106e82924e | ||||||
|  | @ -5,6 +5,7 @@ import ( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type Conf struct { | type Conf struct { | ||||||
|  | 	Score   int | ||||||
| 	Comment string | 	Comment string | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -19,7 +20,7 @@ func (*Dummy) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 	} | 	} | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	for range results { | 	for range results { | ||||||
| 		res = append(res, stage.ParserResult{Score: 0, Comment: conf.Comment}) | 		res = append(res, stage.ParserResult{Score: conf.Score, Comment: conf.Comment}) | ||||||
| 	} | 	} | ||||||
| 	return res, false, nil | 	return res, false, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -7,22 +7,24 @@ import ( | ||||||
| 	"github.com/criyle/go-judge/envexec" | 	"github.com/criyle/go-judge/envexec" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type Conf struct{} | type Conf struct { | ||||||
|  | 	Score   int | ||||||
|  | 	Comment string | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| type ResultStatus struct{} | type ResultStatus struct{} | ||||||
| 
 | 
 | ||||||
| func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 	[]stage.ParserResult, bool, error, | 	[]stage.ParserResult, bool, error, | ||||||
| ) { | ) { | ||||||
| 	// TODO: more conf options
 | 	conf, err := stage.DecodeConf[Conf](confAny) | ||||||
| 	_, err := stage.DecodeConf[Conf](confAny) |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
| 	forceQuit := false | 	forceQuit := false | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
| 		comment := "" | 		comment := conf.Comment | ||||||
| 		if result.Status != stage.Status(envexec.StatusAccepted) { | 		if result.Status != stage.Status(envexec.StatusAccepted) { | ||||||
| 			forceQuit = true | 			forceQuit = true | ||||||
| 			comment = fmt.Sprintf( | 			comment = fmt.Sprintf( | ||||||
|  | @ -30,7 +32,7 @@ func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 			) | 			) | ||||||
| 		} | 		} | ||||||
| 		res = append(res, stage.ParserResult{ | 		res = append(res, stage.ParserResult{ | ||||||
| 			Score:   0, | 			Score:   conf.Score, | ||||||
| 			Comment: comment, | 			Comment: comment, | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user