| Conditions | 8 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | |||
| 17 | def is_time_to_run(self): |
||
| 18 | if self.is_disabled(): |
||
| 19 | return False |
||
| 20 | now = datetime.datetime.now() |
||
| 21 | if self.pending_run: |
||
| 22 | self.pending_run = False |
||
| 23 | return self.kick_it_off(True) |
||
| 24 | if self.lastrun is None and self.start is None: |
||
| 25 | #never run before, run now |
||
| 26 | return self.kick_it_off(True) |
||
| 27 | elif self.start is not None and self.lastrun is None: |
||
| 28 | #never run before and after start time |
||
| 29 | return self.kick_it_off(now >= self.start) |
||
| 30 | else: |
||
| 31 | sincelast = now - self.lastrun |
||
| 32 | if sincelast.total_seconds() >= self.interval: |
||
| 33 | return self.kick_it_off(True) |
||
| 34 | return False |
||
| 35 | |||
| 40 |