From b4cc152c778c9f21f1e0a151b9d29760fbbf1476 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 29 Jan 2026 22:30:58 +0100 Subject: exercises: simplify the kind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As for now, all exercises I have follow the same pattern and there can be multiple workflows that can fit to it. Yes, maybe in the future it might be interesting to add other kinds of exercises, but for now I'm good and we can keep things simple. Signed-off-by: Miquel Sabaté Solà --- lib/mihi/src/exercise.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/mihi/src/exercise.rs b/lib/mihi/src/exercise.rs index 10fada1..5f45079 100644 --- a/lib/mihi/src/exercise.rs +++ b/lib/mihi/src/exercise.rs @@ -5,19 +5,13 @@ use rusqlite::params; #[derive(Clone, Copy, Debug, Default)] pub enum ExerciseKind { #[default] - Pensum = 0, - Translation, - Transformation, - Numerical, + Simple = 0, } impl std::fmt::Display for ExerciseKind { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Self::Pensum => write!(f, "Pensum"), - Self::Translation => write!(f, "Translation"), - Self::Transformation => write!(f, "Transformation"), - Self::Numerical => write!(f, "Numerical"), + Self::Simple => write!(f, "Simple"), } } } @@ -27,10 +21,7 @@ impl TryFrom for ExerciseKind { fn try_from(value: isize) -> Result { match value { - 0 => Ok(Self::Pensum), - 1 => Ok(Self::Translation), - 2 => Ok(Self::Transformation), - 3 => Ok(Self::Numerical), + 0 => Ok(Self::Simple), _ => Err("unknonwn exercise kind"), } } @@ -41,11 +32,8 @@ impl TryFrom<&str> for ExerciseKind { fn try_from(value: &str) -> Result { match value { - "pensum" => Ok(Self::Pensum), - "translation" => Ok(Self::Translation), - "transformation" => Ok(Self::Transformation), - "numerical" => Ok(Self::Numerical), - _ => Err("unknonwn exercise kind. Available: pensum, translation, transformation and numerical"), + "simple" => Ok(Self::Simple), + _ => Err("unknonwn exercise kind. Available: simple"), } } } -- cgit v1.2.3