Add Client.archived flag, ignore archived for "disabled probes" check

this lets us keep old client config around without deleting it, but it should
not interfere with other logic etc.
This commit is contained in:
Lance Edgar 2018-09-28 12:21:21 -05:00
parent 018a9dcb08
commit 152ea26c02
3 changed files with 48 additions and 2 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2017 Lance Edgar
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
@ -32,14 +32,16 @@ from rattail_tempmon.db import Session as TempmonSession, model as tempmon
def disabled_probes(config, progress=None):
"""
Notifies if any Tempmon client devices or probes are disabled.
Notifies if any (non-archived) Tempmon client devices or probes are disabled.
"""
tempmon_session = TempmonSession()
clients = tempmon_session.query(tempmon.Client)\
.filter(tempmon.Client.archived == False)\
.filter(tempmon.Client.enabled == False)\
.all()
probes = tempmon_session.query(tempmon.Probe)\
.join(tempmon.Client)\
.filter(tempmon.Client.archived == False)\
.filter(tempmon.Client.enabled == True)\
.filter(tempmon.Probe.enabled == False)\
.all()