Skip to content

Commit

Permalink
Include course module completion date in the csv
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed May 3, 2024
1 parent 54f59cf commit a28becd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ pub struct CourseModuleCompletionWithRegistrationInfo {
pub registered: bool,
/// ID of the user for the completion.
pub user_id: Uuid,
// When the user completed the course
pub completion_date: DateTime<Utc>,
}

/// Gets summaries for all completions on the given course instance.
Expand All @@ -218,7 +220,8 @@ SELECT completions.completion_registration_attempt_date,
completions.passed,
completions.prerequisite_modules_completed,
(registered.id IS NOT NULL) AS "registered!",
completions.user_id
completions.user_id,
completions.completion_date
FROM course_module_completions completions
LEFT JOIN course_module_completion_registered_to_study_registries registered ON (
completions.id = registered.course_module_completion_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ where
let module_name = module.name.as_deref().unwrap_or("default_module");
headers.push(format!("{module_name}_grade"));
headers.push(format!("{module_name}_registered"));
headers.push(format!("{module_name}_completion_date"));
}

// write rows
Expand Down Expand Up @@ -100,6 +101,11 @@ where
.map(|cm| cm.registered.to_string())
.unwrap_or_default();
csv_row.push(registered);
csv_row.push(
user_completion
.map(|uc| uc.completion_date.to_string())
.unwrap_or_default(),
)
}
// To avoid confusion with some people potentially not understanding that '-' means not completed,
// we'll skip the users that don't have any completions from any modules. The confusion is less likely in cases where there are more than one module, and only in those cases the teachers would see the '-' entries in this file.
Expand Down

0 comments on commit a28becd

Please sign in to comment.