aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-07 22:44:08 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 04:02:37 +0900
commitd799993a4fe0d05aa72c9a48d4a76c6db2240038 (patch)
tree5cea8c2a06029cbed9b4ed642545567a899c63aa
parent963292574fd72ec62ebc75c308f1275de531a2e9 (diff)
downloadiosdc-japan-2024-albatross-d799993a4fe0d05aa72c9a48d4a76c6db2240038.tar.gz
iosdc-japan-2024-albatross-d799993a4fe0d05aa72c9a48d4a76c6db2240038.tar.zst
iosdc-japan-2024-albatross-d799993a4fe0d05aa72c9a48d4a76c6db2240038.zip
feat(backend): make testcase_executions.testcase_id non-null
-rw-r--r--backend/db/models.go2
-rw-r--r--backend/db/query.sql.go2
-rw-r--r--backend/schema.sql2
-rw-r--r--backend/taskqueue/processor.go4
4 files changed, 5 insertions, 5 deletions
diff --git a/backend/db/models.go b/backend/db/models.go
index 431d860..126b5f2 100644
--- a/backend/db/models.go
+++ b/backend/db/models.go
@@ -49,7 +49,7 @@ type Testcase struct {
type TestcaseExecution struct {
TestcaseExecutionID int32
SubmissionID int32
- TestcaseID *int32
+ TestcaseID int32
Status string
Stdout string
Stderr string
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index 18acfda..eefa8a0 100644
--- a/backend/db/query.sql.go
+++ b/backend/db/query.sql.go
@@ -43,7 +43,7 @@ VALUES ($1, $2, $3, $4, $5)
type CreateTestcaseExecutionParams struct {
SubmissionID int32
- TestcaseID *int32
+ TestcaseID int32
Status string
Stdout string
Stderr string
diff --git a/backend/schema.sql b/backend/schema.sql
index d0b6c40..27a63d1 100644
--- a/backend/schema.sql
+++ b/backend/schema.sql
@@ -67,7 +67,7 @@ CREATE TABLE submissions (
CREATE TABLE testcase_executions (
testcase_execution_id SERIAL PRIMARY KEY,
submission_id INT NOT NULL,
- testcase_id INT,
+ testcase_id INT NOT NULL,
status VARCHAR(16) NOT NULL,
stdout TEXT NOT NULL,
stderr TEXT NOT NULL,
diff --git a/backend/taskqueue/processor.go b/backend/taskqueue/processor.go
index ca180e9..098b565 100644
--- a/backend/taskqueue/processor.go
+++ b/backend/taskqueue/processor.go
@@ -168,7 +168,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
if resData.Result != "success" {
err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
SubmissionID: submissionID,
- TestcaseID: &testcase.TestcaseID,
+ TestcaseID: testcase.TestcaseID,
Status: resData.Result,
Stdout: resData.Stdout,
Stderr: resData.Stderr,
@@ -185,7 +185,7 @@ func (p *ExecProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
if !isTestcaseExecutionCorrect(testcase.Stdout, resData.Stdout) {
err := p.q.CreateTestcaseExecution(ctx, db.CreateTestcaseExecutionParams{
SubmissionID: submissionID,
- TestcaseID: &testcase.TestcaseID,
+ TestcaseID: testcase.TestcaseID,
Status: "wrong_answer",
Stdout: resData.Stdout,
Stderr: resData.Stderr,