Add waiting for next period
This commit is contained in:
parent
6f2deb38e1
commit
0b0350da0e
5 changed files with 105 additions and 37 deletions
emgauwa-lib/src/db
|
@ -198,4 +198,12 @@ impl DbSchedule {
|
|||
pub fn is_on(&self, now: &NaiveTime) -> bool {
|
||||
self.periods.0.iter().any(|period| period.is_on(now))
|
||||
}
|
||||
|
||||
pub fn get_next_time(&self, now: &NaiveTime) -> Option<NaiveTime> {
|
||||
self.periods
|
||||
.0
|
||||
.iter()
|
||||
.filter_map(|period| period.get_next_time(now))
|
||||
.min()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue