corrected error with validate_attr

This commit is contained in:
ModulatingForce 2024-03-28 20:21:49 -04:00
parent 5c35ad114a
commit 66195138f8
2 changed files with 55 additions and 16 deletions

View file

@ -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<Local>), // 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,
);

View file

@ -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",