From 66195138f83cc6443dbaccd349d0fdf2183609d3 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Thu, 28 Mar 2024 20:21:49 -0400 Subject: [PATCH] corrected error with validate_attr --- src/core/botmodules.rs | 61 +++++++++++++++++------- src/custom/experimental/experiment003.rs | 10 ++++ 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 3da6122..2cfbb77 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -580,7 +580,7 @@ impl BotActionTrait for Listener { } // #[derive(Debug, PartialEq, Eq, Hash, Clone)] -#[derive(PartialEq, Eq, Hash)] +#[derive(Debug, PartialEq, Eq, Hash)] pub enum RoutineAttr { DelayedStart, ScheduledStart(DateTime), // Scheduled Date (if any) after which, if not started, may trigger @@ -718,31 +718,60 @@ impl Routine { // } // ); + let mut attribute_supported = false; for given_routine in routine_attr { - if !matches!(given_routine,RoutineAttr::DelayedStart) - && !matches!(given_routine,RoutineAttr::ScheduledStart(_)) - && !matches!(given_routine,RoutineAttr::LoopDuration(_)) - && !matches!(given_routine,RoutineAttr::LoopInfinitely) - && !matches!(given_routine,RoutineAttr::RunOnce) - && !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_)) - && !matches!(given_routine,RoutineAttr::MaxIterations(_)) + // if !matches!(given_routine,RoutineAttr::DelayedStart) + // && !matches!(given_routine,RoutineAttr::ScheduledStart(_)) + // && !matches!(given_routine,RoutineAttr::LoopDuration(_)) + // && !matches!(given_routine,RoutineAttr::LoopInfinitely) + // && !matches!(given_routine,RoutineAttr::RunOnce) + // && !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_)) + // && !matches!(given_routine,RoutineAttr::MaxIterations(_)) + if matches!(given_routine,RoutineAttr::DelayedStart) + || matches!(given_routine,RoutineAttr::ScheduledStart(_)) + || matches!(given_routine,RoutineAttr::LoopDuration(_)) + || matches!(given_routine,RoutineAttr::LoopInfinitely) + || matches!(given_routine,RoutineAttr::RunOnce) + || matches!(given_routine,RoutineAttr::MaxTimeThreshold(_)) + || matches!(given_routine,RoutineAttr::MaxIterations(_)) + { - botlog::trace( - "[ERROR][Routine Feature NOT IMPLEMENTED]", - Some("Routine > Validate_attr()".to_string()), - None, - ); - Log::flush(); + attribute_supported = true; - return Err("NOT IMPLEMENTED".to_string()); } }; + if !attribute_supported { + botlog::trace( + "[ERROR][Routine Feature NOT IMPLEMENTED]", + Some("Routine > Validate_attr()".to_string()), + None, + ); + + Log::flush(); + + botlog::trace( + format!( + "[ERROR][Routine Feature NOT IMPLEMENTED] > Problem Routine - {:?}" + ,routine_attr).as_str(), + Some("Routine > Validate_attr()".to_string()), + None, + ); + + Log::flush(); + + return Err("NOT IMPLEMENTED".to_string()); + } + + + + + // if unimplemented.next().is_some() { @@ -809,7 +838,7 @@ impl Routine { // { botlog::trace( - "[ERROR][Routine Feature NOT IMPLEMENTED]", + "[OK][Implemented & Validated]", Some("Routine > Validate_attr()".to_string()), None, ); diff --git a/src/custom/experimental/experiment003.rs b/src/custom/experimental/experiment003.rs index c881d90..a37066f 100644 --- a/src/custom/experimental/experiment003.rs +++ b/src/custom/experimental/experiment003.rs @@ -191,6 +191,16 @@ async fn countdown_chnl_v1(params : ExecBodyParams) { // Some(a) => a, // }; + // let routine_lock = arr.read().await; + // if let Some(a) = routine_lock.remaining_iterations.clone() { + // println!("Remaining iterations > {}",a) + // } + + { + let routine_lock = arr.write().await; + let a = routine_lock.remaining_iterations; + println!("remaining iterations : {:?}", a); +} botlog::trace( "after loading remaining iterations",