Skip to contents

Filters summarise_students() to students with activity, incomplete work, and a percent below a configurable threshold.

Usage

detect_stalled_students(
  con,
  tutorial_id,
  rule = c("last", "best", "first"),
  include_unregistered = TRUE,
  group_id = NULL,
  max_percent = 60,
  min_attempts = 1,
  require_incomplete = TRUE
)

Arguments

con

A DBI connection.

tutorial_id

Tutorial identifier. Required.

rule

Scoring rule used to select one attempt per student and question.

include_unregistered

If TRUE, include attempted questions not registered with register_questions().

group_id

Optional registered student group identifier. If supplied, only attempts from students in that group are included.

max_percent

Maximum percent used to flag a student. Defaults to 60.

min_attempts

Minimum number of attempts before a student can be flagged. Defaults to 1.

require_incomplete

If TRUE, only incomplete students are flagged. Defaults to TRUE.

Value

A tibble of flagged student summaries.

Examples

db_path <- tempfile(fileext = ".sqlite")
con <- init_tracking_db(db_path, overwrite = TRUE)
register_questions(con, "module_01", c("q1", "q2"))
#> # A tibble: 2 × 6
#>   question_id tutorial_id question_label question_type max_score created_at     
#>   <chr>       <chr>       <chr>          <chr>             <dbl> <chr>          
#> 1 q1          module_01   q1             NA                    1 2026-06-24T12:…
#> 2 q2          module_01   q2             NA                    1 2026-06-24T12:…
track_attempt(con, "student_001", "module_01", "q1", "wrong", score = 0, max_score = 1)
detect_stalled_students(con, "module_01")
#> # A tibble: 1 × 15
#>   student_id  student_label email group_id tutorial_id score max_score percent
#>   <chr>       <chr>         <chr> <chr>    <chr>       <dbl>     <dbl>   <dbl>
#> 1 student_001 NA            NA    NA       module_01       0         2       0
#> # ℹ 7 more variables: n_questions <int>, n_answered <int>, n_unanswered <int>,
#> #   completed <lgl>, n_attempts <int>, last_activity <chr>, status <chr>
DBI::dbDisconnect(con)