Skip to content

Commit 11ca2bd

Browse files
committed
Fallback to download exercise template, if exercise submissions hidden
1 parent f6ae324 commit 11ca2bd

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

tmc-client/src/response.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ pub struct ExercisesDetails {
270270
pub course_name: String,
271271
pub exercise_name: String,
272272
pub checksum: String,
273+
pub hide_submission_results: bool,
273274
}
274275

275276
/// get /api/v8/courses/{course_id}/submissions

tmc-langs/src/lib.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -282,25 +282,27 @@ pub fn download_or_update_course_exercises(
282282
.into_iter()
283283
.max_by_key(|s| s.created_at)
284284
{
285-
// previous submission found
286-
to_be_downloaded.push(DownloadTarget {
287-
target: ExerciseDownload {
288-
id: exercise_detail.id,
289-
course_slug: exercise_detail.course_name,
290-
exercise_slug: exercise_detail.exercise_name,
291-
path: target,
292-
},
293-
checksum: exercise_detail.checksum,
294-
kind: DownloadTargetKind::Submission {
295-
submission_id: latest_submission.id,
296-
},
297-
});
298-
continue;
285+
// previous submission found, check if exercise submission results hidden (part of exam)
286+
if !exercise_detail.hide_submission_results {
287+
to_be_downloaded.push(DownloadTarget {
288+
target: ExerciseDownload {
289+
id: exercise_detail.id,
290+
course_slug: exercise_detail.course_name,
291+
exercise_slug: exercise_detail.exercise_name,
292+
path: target,
293+
},
294+
checksum: exercise_detail.checksum,
295+
kind: DownloadTargetKind::Submission {
296+
submission_id: latest_submission.id,
297+
},
298+
});
299+
continue;
300+
}
299301
}
300302
}
301303
}
302304

303-
// not skipped, either not on disk or no previous submissions, downloading template
305+
// not skipped, either not on disk or no previous submissions or submission result hidden, downloading template
304306
to_be_downloaded.push(DownloadTarget {
305307
target: ExerciseDownload {
306308
id: exercise_detail.id,

0 commit comments

Comments
 (0)