Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 435929d

Browse files
committedMay 22, 2025
Update exercises
1 parent 1967ff9 commit 435929d

File tree

49 files changed

+358
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+358
-174
lines changed
 

‎crates/tmc-langs-cli/src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::path::PathBuf;
44
use thiserror::Error;
5-
use tmc_langs::ExerciseDownload;
5+
use tmc_langs::TmcExerciseDownload;
66

77
#[derive(Debug, Error)]
88
#[error("Invalid token. Deleted credentials file")]
@@ -20,7 +20,7 @@ pub struct SandboxTestError {
2020
#[derive(Debug, Error)]
2121
#[error("Failed to download one or more exercises")]
2222
pub struct DownloadsFailedError {
23-
pub downloaded: Vec<ExerciseDownload>,
24-
pub skipped: Vec<ExerciseDownload>,
25-
pub failed: Vec<(ExerciseDownload, Vec<String>)>,
23+
pub downloaded: Vec<TmcExerciseDownload>,
24+
pub skipped: Vec<TmcExerciseDownload>,
25+
pub failed: Vec<(TmcExerciseDownload, Vec<String>)>,
2626
}

‎crates/tmc-langs-cli/src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use std::{
2424
path::{Path, PathBuf},
2525
};
2626
use tmc_langs::{
27-
CommandError, Compression, Credentials, DownloadOrUpdateCourseExercisesResult, DownloadResult,
28-
Language, StyleValidationResult, TmcConfig, UpdatedExercise,
27+
CommandError, Compression, Credentials, DownloadOrUpdateTmcCourseExercisesResult,
28+
DownloadResult, Language, StyleValidationResult, TmcConfig, UpdatedExercise,
2929
file_util::{self, Lock, LockOptions},
3030
mooc::{MoocClient, MoocClientError},
3131
tmc::{TestMyCodeClient, TestMyCodeClientError, request::FeedbackAnswer},
@@ -231,7 +231,7 @@ fn run_app(cli: Cli) -> Result<CliOutput> {
231231
let mut lock = Lock::dir(&exercise_path, LockOptions::Read)?;
232232
let _guard = lock.lock()?;
233233

234-
let hash = tmc_langs::compress_project_to(
234+
let hash = tmc_langs::compress_project_to_with_hash(
235235
&exercise_path,
236236
&output_path,
237237
compression,
@@ -674,7 +674,7 @@ fn run_tmc_inner(
674674
DownloadResult::Success {
675675
downloaded,
676676
skipped,
677-
} => DownloadOrUpdateCourseExercisesResult {
677+
} => DownloadOrUpdateTmcCourseExercisesResult {
678678
downloaded,
679679
skipped,
680680
failed: None,
@@ -683,15 +683,15 @@ fn run_tmc_inner(
683683
downloaded,
684684
skipped,
685685
failed,
686-
} => DownloadOrUpdateCourseExercisesResult {
686+
} => DownloadOrUpdateTmcCourseExercisesResult {
687687
downloaded,
688688
skipped,
689689
failed: Some(failed),
690690
},
691691
};
692692
CliOutput::finished_with_data(
693693
"downloaded or updated exercises",
694-
DataKind::ExerciseDownload(data),
694+
DataKind::TmcExerciseDownload(data),
695695
)
696696
}
697697

@@ -1011,10 +1011,10 @@ fn run_tmc_inner(
10111011

10121012
TestMyCodeCommand::UpdateExercises => {
10131013
let projects_dir = tmc_langs::get_projects_dir(client_name)?;
1014-
let data = tmc_langs::update_exercises(client, &projects_dir)?;
1014+
let data = tmc_langs::update_tmc_exercises(client, &projects_dir)?;
10151015
CliOutput::finished_with_data(
10161016
"downloaded or updated exercises",
1017-
DataKind::ExerciseDownload(data),
1017+
DataKind::TmcExerciseDownload(data),
10181018
)
10191019
}
10201020

@@ -1064,6 +1064,8 @@ fn run_mooc(mooc: Mooc) -> Result<CliOutput> {
10641064
}
10651065

10661066
fn run_mooc_inner(mooc: Mooc, client: &mut MoocClient) -> Result<CliOutput> {
1067+
let client_name = &mooc.client_name;
1068+
10671069
let output = match mooc.command {
10681070
MoocCommand::CourseInstance {
10691071
course_instance_id: _,
@@ -1102,6 +1104,11 @@ fn run_mooc_inner(mooc: Mooc, client: &mut MoocClient) -> Result<CliOutput> {
11021104
)?;
11031105
CliOutput::finished("downloaded exercise")
11041106
}
1107+
MoocCommand::UpdateExercises => {
1108+
let projects_dir = tmc_langs::get_projects_dir(client_name)?;
1109+
let res = tmc_langs::update_mooc_exercises(client, &projects_dir)?;
1110+
CliOutput::finished_with_data("updated exercises", DataKind::MoocExerciseDownload(res))
1111+
}
11051112
MoocCommand::Submit {
11061113
exercise_id,
11071114
slide_id,
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.