Add is_on functions
This commit is contained in:
parent
6414083af0
commit
0460e838bc
4 changed files with 32 additions and 2 deletions
emgauwa-lib/src/db
|
@ -1,6 +1,7 @@
|
|||
use std::borrow::Borrow;
|
||||
use std::ops::DerefMut;
|
||||
|
||||
use chrono::NaiveTime;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use sqlx::pool::PoolConnection;
|
||||
use sqlx::Sqlite;
|
||||
|
@ -193,4 +194,8 @@ impl DbSchedule {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_on(&self, now: &NaiveTime) -> bool {
|
||||
self.periods.0.iter().any(|period| period.is_on(now))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue