Skip to content

Commit

Permalink
Changes to query
Browse files Browse the repository at this point in the history
  • Loading branch information
Maija Y committed Jul 11, 2024
1 parent bfd4b83 commit bd28a03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 83 deletions.

This file was deleted.

11 changes: 6 additions & 5 deletions services/headless-lms/models/src/exercise_slide_submissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ pub async fn get_latest_exercise_slide_submissions_and_user_exercise_state_list_
let submissions = sqlx::query_as!(
ExerciseSlideSubmission,
r#"
SELECT id,
SELECT DISTINCT ON (user_id)
id,
created_at,
updated_at,
deleted_at,
Expand All @@ -525,11 +526,11 @@ pub async fn get_latest_exercise_slide_submissions_and_user_exercise_state_list_
exercise_id,
user_id,
user_points_update_strategy AS "user_points_update_strategy: _"
FROM exercise_slide_submissions
WHERE exercise_id = $1
FROM exercise_slide_submissions
WHERE exercise_id = $1
AND deleted_at IS NULL
AND created_at in (SELECT MAX(created_at) FROM exercise_slide_submissions GROUP BY user_id, exercise_slide_id)
LIMIT $2 OFFSET $3
ORDER BY user_id, created_at DESC
LIMIT $2 OFFSET $3
"#,
exercise_id,
pagination.limit(),
Expand Down

0 comments on commit bd28a03

Please sign in to comment.