From 98ffafddb7510b05dc6d5a7dbacbc34e919bbb7e Mon Sep 17 00:00:00 2001 From: phil Date: Fri, 20 Mar 2026 19:07:17 -0400 Subject: [PATCH] wire in the day3 check --- .../advent/challenges/day_three/day_three.rs | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/shared/src/advent/challenges/day_three/day_three.rs b/shared/src/advent/challenges/day_three/day_three.rs index d63410a..3cf2ee7 100644 --- a/shared/src/advent/challenges/day_three/day_three.rs +++ b/shared/src/advent/challenges/day_three/day_three.rs @@ -70,9 +70,34 @@ impl AdventChallenge for DayThree { async fn check_part_one( &self, - _did: String, - _verification_code: Option, + did: String, + verification_code: Option, ) -> Result { - todo!() + let Some(submitted_code) = verification_code else { + return Ok(ChallengeCheckResponse::Incorrect( + "No code was submitted!".to_string(), + )); + }; + + let Some(progress) = self.get_days_challenge(&did).await? else { + return Err(AdventError::ShouldNotHappen( + "Challenge not started".to_string(), + )); + }; + + let Some(expected) = progress.verification_code_one else { + return Err(AdventError::ShouldNotHappen( + "No verification code found".to_string(), + )); + }; + + if submitted_code.trim().eq_ignore_ascii_case(&expected) { + Ok(ChallengeCheckResponse::Correct) + } else { + Ok(ChallengeCheckResponse::Incorrect( + "That's not the right code. Try inspecting the record data inside the CAR file.".into() + )) + } } + } -- 2.51.2