diff --git a/rattail_tempmon/server.py b/rattail_tempmon/server.py index 7b834dc..615bddc 100644 --- a/rattail_tempmon/server.py +++ b/rattail_tempmon/server.py @@ -183,13 +183,12 @@ class TempmonServerDaemon(Daemon): return False def update_status(self, probe, status, reading=None): - now = localtime(self.config) data = { 'probe': probe, 'status': self.enum.TEMPMON_PROBE_STATUS[status], 'reading': reading, 'taken': localtime(self.config, reading.taken, from_utc=True) if reading else None, - 'now': now, + 'now': localtime(self.config, self.now, from_utc=True), } prev_status = probe.status @@ -232,10 +231,10 @@ class TempmonServerDaemon(Daemon): # fetch last 90 minutes of readings session = orm.object_session(probe) recent_minutes = 90 # TODO: make configurable - cutoff = now - datetime.timedelta(seconds=(60 * recent_minutes)) + cutoff = self.now - datetime.timedelta(seconds=(60 * recent_minutes)) readings = session.query(tempmon.Reading)\ .filter(tempmon.Reading.probe == probe)\ - .filter(tempmon.Reading.taken >= make_utc(cutoff))\ + .filter(tempmon.Reading.taken >= cutoff)\ .order_by(tempmon.Reading.taken.desc()) data['recent_minutes'] = recent_minutes data['recent_readings'] = readings