diff options
| -rw-r--r-- | backend/db/models.go | 2 | ||||
| -rw-r--r-- | backend/db/query.sql.go | 2 | ||||
| -rw-r--r-- | backend/schema.sql | 2 | ||||
| -rw-r--r-- | backend/taskqueue/processor.go | 4 |
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, |
