Skip to contents

Computes one score per student and tutorial from recorded attempts. For each question, the selected attempt is determined by rule.

Usage

compute_scores(con, tutorial_id = NULL, rule = c("last", "best", "first"))

Arguments

con

A DBI connection.

tutorial_id

Optional tutorial identifier used to filter attempts.

rule

Scoring rule. "last" keeps the last attempt per question, "best" keeps the attempt with the highest score, and "first" keeps the first attempt.

Value

A tibble with student_id, tutorial_id, score, max_score, percent, n_questions, and n_answered.

Examples

db_path <- tempfile(fileext = ".sqlite")
con <- init_tracking_db(db_path, overwrite = TRUE)
track_attempt(con, "student_001", "module_01", "q1", "mean(x)", score = 1, max_score = 1)
compute_scores(con, tutorial_id = "module_01")
#>    student_id tutorial_id score max_score percent n_questions n_answered
#> 1 student_001   module_01     1         1     100           1          1
DBI::dbDisconnect(con)