pub async fn get_course_students_page(
conn: &mut PgConnection,
course_id: Uuid,
pagination: Pagination,
search: Option<&str>,
sort_column: Option<&str>,
sort_direction: Option<&str>,
course_instance_id: Option<Uuid>,
module_id: Option<Uuid>,
grade: Option<&str>,
registration_stages: &[StudentFacingCreditRegistrationStatus],
) -> ModelResult<StudentsListPage>Expand description
Returns a filtered, sorted, paginated page of the course’s enrolled users (identity only).
sort_column (last_name | first_name | email | total_points) and sort_direction are
narrowed to fixed literals and bound as parameters, never interpolated from raw input. search
matches names and emails as crate::user_details::UserListSearch describes (every word, in any order,
or a near match for a typo), plus an exact user-id match when it parses as a UUID.
course_instance_id narrows to a single instance.
module_id + grade together narrow to students whose latest completion of that module matches:
a numeric grade string (sis-0-5 scale), GRADE_FILTER_PASSED/GRADE_FILTER_FAILED (the
sis-hyv-hyl scale, i.e. grade IS NULL), or GRADE_FILTER_NOT_COMPLETED (no completion row at
all). A numerically graded module’s completions never match passed/failed – those only ever
apply to modules that use the pass/fail scale, mirroring how CompletionsTab renders the grade
column (a numeric grade takes precedence over passed/failed). grade is ignored unless module_id
is also set.
registration_stages narrows to students holding at least one live credit registration at one of
those stages, within course_instance_id and module_id where either is given. Empty means no
narrowing.