Inserts one attempt in the attempts table. If session_id is NULL, a
simple session identifier is generated from the student, tutorial, and date.
If attempt_number is NULL, the next number is computed for the
student-tutorial-question combination.
Usage
track_attempt(
con,
student_id,
tutorial_id,
question_id,
submitted_answer,
grade_status = NA_character_,
score = NA_real_,
max_score = NA_real_,
feedback = NA_character_,
session_id = NULL,
attempt_number = NULL,
timestamp = Sys.time(),
require_registered_student = FALSE
)Arguments
- con
A DBI connection.
- student_id
Student identifier.
- tutorial_id
Tutorial identifier.
- question_id
Question identifier.
- submitted_answer
Submitted answer as text.
- grade_status
Optional grading status, such as
"correct"or"partial".- score
Optional numeric score.
- max_score
Optional numeric maximum score.
- feedback
Optional feedback text.
- session_id
Optional session identifier.
- attempt_number
Optional positive integer attempt number.
- timestamp
Attempt timestamp. Defaults to
Sys.time().- require_registered_student
If
TRUE,student_idmust already be present in thestudentstable throughregister_students().
Examples
db_path <- tempfile(fileext = ".sqlite")
con <- init_tracking_db(db_path, overwrite = TRUE)
track_attempt(
con = con,
student_id = "student_001",
tutorial_id = "module_01",
question_id = "q1",
submitted_answer = "mean(x)",
grade_status = "correct",
score = 1,
max_score = 1,
feedback = "Correct."
)
DBI::dbDisconnect(con)