Skip to content

Commit

Permalink
fix(contest): fix submission and acceptation (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 authored Dec 6, 2024
1 parent 3adb1ce commit 042e87e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/contest-list-problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"algohub-server": patch:fix
---

Fix listing submissions and acceptations for problems in contest list.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/routes/contest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ pub async fn list_problems(

let problems = contest::list_problems(db, id, auth.id).await?;

dbg!(&problems);

Ok(Json(Response {
success: true,
message: "Problems listed successfully".into(),
Expand Down
5 changes: 2 additions & 3 deletions src/utils/contest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ SELECT title, record::id(id) AS id, count(
AND judge_result.status.type == "accepted"
) > 0 AS solved,
count(
SELECT record::id(creator)
FROM submission WHERE record::id(creator) == $account_id AND problem == $parent.id
SELECT record::id(creator) FROM submission WHERE problem == $parent.id
) AS submittedCount,
count(
SELECT record::id(creator)
FROM submission WHERE record::id(creator) == $account_id AND problem == $parent.id
FROM submission WHERE problem == $parent.id
AND judge_result.status.type == "accepted"
) AS acceptedCount
FROM type::thing("contest", $id).problems;
Expand Down

0 comments on commit 042e87e

Please sign in to comment.