corrected error with validate_attr
This commit is contained in:
parent
5c35ad114a
commit
66195138f8
2 changed files with 55 additions and 16 deletions
|
@ -580,7 +580,7 @@ impl BotActionTrait for Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
// #[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
#[derive(PartialEq, Eq, Hash)]
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum RoutineAttr {
|
pub enum RoutineAttr {
|
||||||
DelayedStart,
|
DelayedStart,
|
||||||
ScheduledStart(DateTime<Local>), // Scheduled Date (if any) after which, if not started, may trigger
|
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 {
|
for given_routine in routine_attr {
|
||||||
|
|
||||||
if !matches!(given_routine,RoutineAttr::DelayedStart)
|
// if !matches!(given_routine,RoutineAttr::DelayedStart)
|
||||||
&& !matches!(given_routine,RoutineAttr::ScheduledStart(_))
|
// && !matches!(given_routine,RoutineAttr::ScheduledStart(_))
|
||||||
&& !matches!(given_routine,RoutineAttr::LoopDuration(_))
|
// && !matches!(given_routine,RoutineAttr::LoopDuration(_))
|
||||||
&& !matches!(given_routine,RoutineAttr::LoopInfinitely)
|
// && !matches!(given_routine,RoutineAttr::LoopInfinitely)
|
||||||
&& !matches!(given_routine,RoutineAttr::RunOnce)
|
// && !matches!(given_routine,RoutineAttr::RunOnce)
|
||||||
&& !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_))
|
// && !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_))
|
||||||
&& !matches!(given_routine,RoutineAttr::MaxIterations(_))
|
// && !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() {
|
// if unimplemented.next().is_some() {
|
||||||
|
|
||||||
|
@ -809,7 +838,7 @@ impl Routine {
|
||||||
// {
|
// {
|
||||||
|
|
||||||
botlog::trace(
|
botlog::trace(
|
||||||
"[ERROR][Routine Feature NOT IMPLEMENTED]",
|
"[OK][Implemented & Validated]",
|
||||||
Some("Routine > Validate_attr()".to_string()),
|
Some("Routine > Validate_attr()".to_string()),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
|
@ -191,6 +191,16 @@ async fn countdown_chnl_v1(params : ExecBodyParams) {
|
||||||
// Some(a) => a,
|
// 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(
|
botlog::trace(
|
||||||
"after loading remaining iterations",
|
"after loading remaining iterations",
|
||||||
|
|
Loading…
Reference in a new issue