Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix-stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Sep 29, 2023
2 parents f6fdd85 + 21ccb6e commit 1d518be
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use anyhow::Result;
use bytes::Bytes;
/*
use futures::TryStreamExt;
use headless_lms_models::exercise_task_submissions; */
use headless_lms_models::course_instances;

use async_trait::async_trait;
Expand Down Expand Up @@ -47,7 +44,7 @@ impl CsvExportDataLoader for CompletionsExportOperation {
}
}

/// Writes the submissions as csv into the writer
/// Writes the completions as csv into the writer
pub async fn export_completions<W>(
conn: &mut PgConnection,
course_instance_id: Uuid,
Expand Down Expand Up @@ -161,8 +158,8 @@ where
for next in course_instances.into_iter() {
let csv_row = vec![
next.id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.name.unwrap_or_default(),
];
writer.write_record(csv_row);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ where
while let Some(next) = stream.try_next().await? {
let csv_row = vec![
next.id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.exercise_type.to_string(),
next.private_spec
.map(|o| o.to_string())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
let csv_row = vec![
next.id.to_string(),
next.user_id.to_string(),
next.created_at.to_string(),
next.created_at.to_rfc3339(),
next.exercise_id.to_string(),
next.exercise_task_id.to_string(),
next.score_given.unwrap_or(0.0).to_string(),
Expand All @@ -97,7 +97,7 @@ impl CsvExportDataLoader for CourseSubmissionExportOperation {
conn: &mut PgConnection,
token: AuthorizationToken,
) -> anyhow::Result<CSVExportAdapter> {
export_course_submissions(
export_course_exercise_task_submissions(
&mut *conn,
self.course_id,
CSVExportAdapter {
Expand All @@ -110,7 +110,7 @@ impl CsvExportDataLoader for CourseSubmissionExportOperation {
}

/// Writes the course submissions as csv into the writer
pub async fn export_course_submissions<W>(
pub async fn export_course_exercise_task_submissions<W>(
conn: &mut PgConnection,
course_id: Uuid,
writer: W,
Expand All @@ -120,7 +120,7 @@ where
{
let headers = IntoIterator::into_iter([
"exercise_slide_submission_id".to_string(),
"id".to_string(),
"exercise_task_submission_id".to_string(),
"user_id".to_string(),
"created_at".to_string(),
"course_instance_id".to_string(),
Expand All @@ -138,7 +138,7 @@ where
next.exercise_slide_submission_id.to_string(),
next.id.to_string(),
next.user_id.to_string(),
next.created_at.to_string(),
next.created_at.to_rfc3339(),
next.course_instance_id
.map(|o| o.to_string())
.unwrap_or_else(|| "".to_string()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ where
while let Some(next) = stream.try_next().await? {
let csv_row = vec![
next.user_id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.first_name.unwrap_or_default(),
next.last_name.unwrap_or_default(),
next.email.to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test("test", async ({ page, headless }, testInfo) => {

const submissionsCsvContents = await downloadToString(submissionsDownload)
expect(submissionsCsvContents).toContain(
"exercise_slide_submission_id,id,user_id,created_at,course_instance_id,exercise_id,exercise_task_id,score_given,data_json",
"exercise_slide_submission_id,exercise_task_submission_id,user_id,created_at,course_instance_id,exercise_id,exercise_task_id,score_given,data_json",
)
expect(submissionsCsvContents).toContain("e10557bd-9835-51b4-b0d9-f1d9689ebc8d")
expect(submissionsCsvContents).toContain(
Expand Down

0 comments on commit 1d518be

Please sign in to comment.