diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-04-02 00:50:07 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-04-02 00:50:07 +0900 |
| commit | 626ab209bc5b1b9f3a608a1c2a536ead3cd27a7f (patch) | |
| tree | a219efd13963265749ca763090ffd38ef019daa6 /backend/db/query.sql.go | |
| parent | 266e3037a4ca24129bb30c818ec2959468585029 (diff) | |
| download | phperkaigi-2025-albatross-626ab209bc5b1b9f3a608a1c2a536ead3cd27a7f.tar.gz phperkaigi-2025-albatross-626ab209bc5b1b9f3a608a1c2a536ead3cd27a7f.tar.zst phperkaigi-2025-albatross-626ab209bc5b1b9f3a608a1c2a536ead3cd27a7f.zip | |
fix(backend): fix incorrect aggregation of testcase results
Diffstat (limited to 'backend/db/query.sql.go')
| -rw-r--r-- | backend/db/query.sql.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index da13f33..fece99f 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -29,15 +29,17 @@ func (q *Queries) AddMainPlayer(ctx context.Context, arg AddMainPlayerParams) er const aggregateTestcaseResults = `-- name: AggregateTestcaseResults :one SELECT CASE - WHEN COUNT(CASE WHEN r.status IS NULL THEN 1 END) > 0 THEN 'running' + WHEN COUNT(*) < (SELECT COUNT(*) FROM testcases WHERE problem_id = + (SELECT problem_id FROM games WHERE game_id = + (SELECT game_id FROM submissions AS s WHERE s.submission_id = $1))) + THEN 'running' WHEN COUNT(CASE WHEN r.status = 'internal_error' THEN 1 END) > 0 THEN 'internal_error' WHEN COUNT(CASE WHEN r.status = 'timeout' THEN 1 END) > 0 THEN 'timeout' WHEN COUNT(CASE WHEN r.status = 'runtime_error' THEN 1 END) > 0 THEN 'runtime_error' WHEN COUNT(CASE WHEN r.status = 'wrong_answer' THEN 1 END) > 0 THEN 'wrong_answer' ELSE 'success' END AS status -FROM testcases -LEFT JOIN testcase_results AS r ON testcases.testcase_id = r.testcase_id +FROM testcase_results AS r WHERE r.submission_id = $1 ` |
