Skip to content

Commit 341a5b9

Browse files
committed
return constructed submission status when waiting on hidden exercise
1 parent 96b04d6 commit 341a5b9

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

tmc-langs-core/src/response.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub enum SubmissionProcessingStatus {
298298

299299
#[derive(Debug, Deserialize, Serialize)]
300300
pub struct SubmissionProcessing {
301-
// pub status: SubmissionStatus // always Processing
301+
pub status: SubmissionStatus,
302302
pub sandbox_status: SandboxStatus,
303303
}
304304

@@ -344,6 +344,7 @@ pub enum SubmissionStatus {
344344
Fail,
345345
Ok,
346346
Error,
347+
Hidden,
347348
}
348349

349350
#[derive(Debug, Deserialize, Serialize, JsonSchema)]

tmc-langs-core/src/tmc_core.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,43 @@ impl TmcCore {
504504
return Ok(*f);
505505
}
506506
SubmissionProcessingStatus::Processing(p) => {
507+
if p.status == SubmissionStatus::Hidden {
508+
// hidden status, return constructed status
509+
self.report_complete("Submission status hidden, stopping waiting.");
510+
let finished = SubmissionFinished {
511+
api_version: 8,
512+
all_tests_passed: Some(true),
513+
user_id: 0,
514+
login: "0".to_string(),
515+
course: "0".to_string(),
516+
exercise_name: "string".to_string(),
517+
status: SubmissionStatus::Hidden,
518+
points: vec![],
519+
validations: None,
520+
valgrind: None,
521+
submission_url: "".to_string(),
522+
solution_url: None,
523+
submitted_at: "string".to_string(),
524+
processing_time: None,
525+
reviewed: false,
526+
requests_review: false,
527+
paste_url: None,
528+
message_for_paste: None,
529+
missing_review_points: vec![],
530+
test_cases: Some(vec![TestCase {
531+
name: "Hidden Exam Test: hidden_test".to_string(),
532+
successful: true,
533+
message: Some("Exam exercise sent to server successfully, you can now continue.".to_string()),
534+
exception: None,
535+
detailed_message: None,
536+
}]),
537+
error: None,
538+
feedback_answer_url: None,
539+
feedback_questions: None,
540+
};
541+
return Ok(finished);
542+
}
543+
507544
match (&mut previous_status, p.sandbox_status) {
508545
(Some(previous), status) if status == *previous => {} // no change, ignore
509546
(_, status) => {

0 commit comments

Comments
 (0)