aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/taskqueue/processor.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-07 22:49:33 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 04:02:37 +0900
commit5a2217f7a9d01b925c3db6491a363e6e4db9ca42 (patch)
tree9b6dcc019834a720a97348d26f1942eb05e84ec1 /backend/taskqueue/processor.go
parentd799993a4fe0d05aa72c9a48d4a76c6db2240038 (diff)
downloadiosdc-japan-2025-albatross-5a2217f7a9d01b925c3db6491a363e6e4db9ca42.tar.gz
iosdc-japan-2025-albatross-5a2217f7a9d01b925c3db6491a363e6e4db9ca42.tar.zst
iosdc-japan-2025-albatross-5a2217f7a9d01b925c3db6491a363e6e4db9ca42.zip
feat(backend): rename testcase_executions to testcase_results
Diffstat (limited to 'backend/taskqueue/processor.go')
-rw-r--r--backend/taskqueue/processor.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go
index 098b565..f789e2e 100644
--- a/backend/taskqueue/processor.go
+++ b/backend/taskqueue/processor.go
@@ -70,7 +70,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
return fmt.Errorf("json.Decode failed: %v", err)
}
if resData.Result != "success" {
- err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
+ err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: nil,
Status: "compile_error",
@@ -78,7 +78,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Stderr: resData.Stderr,
})
if err != nil {
- return fmt.Errorf("CreateTestcaseExecution failed: %v", err)
+ return fmt.Errorf("CreateTestcaseResult failed: %v", err)
}
p.results <- TaskExecResult{
Task: &payload,
@@ -114,7 +114,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
return fmt.Errorf("json.Decode failed: %v", err)
}
if resData.Result != "success" {
- err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
+ err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: nil,
Status: "compile_error",
@@ -122,7 +122,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Stderr: resData.Stderr,
})
if err != nil {
- return fmt.Errorf("CreateTestcaseExecution failed: %v", err)
+ return fmt.Errorf("CreateTestcaseResult failed: %v", err)
}
p.results <- TaskExecResult{
Task: &payload,
@@ -166,7 +166,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
return fmt.Errorf("json.Decode failed: %v", err)
}
if resData.Result != "success" {
- err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
+ err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: testcase.TestcaseID,
Status: resData.Result,
@@ -174,7 +174,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Stderr: resData.Stderr,
})
if err != nil {
- return fmt.Errorf("CreateTestcaseExecution failed: %v", err)
+ return fmt.Errorf("CreateTestcaseResult failed: %v", err)
}
p.results <- TaskExecResult{
Task: &payload,
@@ -182,8 +182,8 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
}
return fmt.Errorf("testrun failed: %v", resData.Stderr)
}
- if !isTestcaseExecutionCorrect(testcase.Stdout, resData.Stdout) {
- err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
+ if !isTestcaseResultCorrect(testcase.Stdout, resData.Stdout) {
+ err := p.q.CreateTestcaseResult(ctx, db.CreateTestcaseResultParams{
SubmissionID: submissionID,
TestcaseID: testcase.TestcaseID,
Status: "wrong_answer",
@@ -191,7 +191,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
Stderr: resData.Stderr,
})
if err != nil {
- return fmt.Errorf("CreateTestcaseExecution failed: %v", err)
+ return fmt.Errorf("CreateTestcaseResult failed: %v", err)
}
p.results <- TaskExecResult{
Task: &payload,
@@ -208,7 +208,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
return nil
}
-func isTestcaseExecutionCorrect(expectedStdout, actualStdout string) bool {
+func isTestcaseResultCorrect(expectedStdout, actualStdout string) bool {
expectedStdout = strings.TrimSpace(expectedStdout)
actualStdout = strings.TrimSpace(actualStdout)
return actualStdout == expectedStdout