this repo has no description

wire in the day3 check

+28 -3
+28 -3
shared/src/advent/challenges/day_three/day_three.rs
··· 70 70 71 71 async fn check_part_one( 72 72 &self, 73 - _did: String, 74 - _verification_code: Option<String>, 73 + did: String, 74 + verification_code: Option<String>, 75 75 ) -> Result<ChallengeCheckResponse, AdventError> { 76 - todo!() 76 + let Some(submitted_code) = verification_code else { 77 + return Ok(ChallengeCheckResponse::Incorrect( 78 + "No code was submitted!".to_string(), 79 + )); 80 + }; 81 + 82 + let Some(progress) = self.get_days_challenge(&did).await? else { 83 + return Err(AdventError::ShouldNotHappen( 84 + "Challenge not started".to_string(), 85 + )); 86 + }; 87 + 88 + let Some(expected) = progress.verification_code_one else { 89 + return Err(AdventError::ShouldNotHappen( 90 + "No verification code found".to_string(), 91 + )); 92 + }; 93 + 94 + if submitted_code.trim().eq_ignore_ascii_case(&expected) { 95 + Ok(ChallengeCheckResponse::Correct) 96 + } else { 97 + Ok(ChallengeCheckResponse::Incorrect( 98 + "That's not the right code. Try inspecting the record data inside the CAR file.".into() 99 + )) 100 + } 77 101 } 102 + 78 103 }