Skip to contents

Deletes attempts and sessions associated with one student identifier. By default, the corresponding row in the student registry is also deleted. Course, tutorial, and question metadata are preserved.

Usage

delete_student_data(con, student_id, delete_student = TRUE)

Arguments

con

A DBI connection.

student_id

Student identifier to delete.

delete_student

If TRUE, also delete the matching row from the students table. If FALSE, preserve the student registry row.

Value

A tibble with deleted row counts by table.

Examples

db_path <- tempfile(fileext = ".sqlite")
con <- init_tracking_db(db_path, overwrite = TRUE)
track_attempt(con, "student_001", "module_01", "q1", "mean(x)")
delete_student_data(con, "student_001")
#> # A tibble: 3 × 2
#>   table    deleted_rows
#>   <chr>           <int>
#> 1 attempts            1
#> 2 sessions            1
#> 3 students            0
DBI::dbDisconnect(con)