From 86095df8b219510bf5cfb9f5d672695bd8b889c6 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 29 Jan 2026 22:37:03 +0100 Subject: run: show the exercise's lessons at the end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- crates/cli/src/run.rs | 7 ++++++- lib/mihi/src/exercise.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/cli/src/run.rs b/crates/cli/src/run.rs index 5f06870..0262515 100644 --- a/crates/cli/src/run.rs +++ b/crates/cli/src/run.rs @@ -535,7 +535,12 @@ fn run_exercises(exercises: Vec) -> bool { // (i.e. refresh the 'updated_at' date). This way, next time we select // exercises to show the user, we can prevent this one showing up first. if accepted_diff(&solution, &exercise.solution) { - let _ = touch_exercise(exercise); + let _ = touch_exercise(&exercise); + } + + let lessons = exercise.lessons.trim(); + if !lessons.is_empty() { + println!("The lessons for this exercise were:\n{}", lessons); } } diff --git a/lib/mihi/src/exercise.rs b/lib/mihi/src/exercise.rs index 5f45079..7249919 100644 --- a/lib/mihi/src/exercise.rs +++ b/lib/mihi/src/exercise.rs @@ -152,7 +152,7 @@ pub fn update_exercise(exercise: Exercise) -> Result<(), String> { } /// Updates the 'updated_at' column for an exercise. -pub fn touch_exercise(exercise: Exercise) -> Result<(), String> { +pub fn touch_exercise(exercise: &Exercise) -> Result<(), String> { if exercise.id == 0 { return Err("invalid exercise to update; seems it has not been created before".to_string()); } -- cgit v1.2.3