Changeset f31a0c4 in rattail-tempmon


Ignore:
Timestamp:
01/25/19 19:33:49 (13 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
cf27af8
Parents:
c45baae
Message:

Convert enabled for Client, Probe to use datetime instead of boolean

value is null if disabled, else timestamp of when it was last enabled

Location:
rattail_tempmon
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • rattail_tempmon/db/model.py

    rc45baae rf31a0c4  
    112112    """)
    113113
    114     enabled = sa.Column(sa.Boolean(), nullable=False, default=False, doc="""
    115     Whether the client should be considered enabled (active).  If set, the
    116     client will be expected to take readings (but only for "enabled" probes)
    117     and the server will monitor them to ensure they are within the expected
    118     range etc.
     114    enabled = sa.Column(sa.DateTime(), nullable=True, doc="""
     115    This will either be the date/time when the client was most recently
     116    enabled, or null if it is not currently enabled.  If set, the client will
     117    be expected to take readings (but only for "enabled" probes) and the server
     118    will monitor them to ensure they are within the expected range etc.
    119119    """)
    120120
     
    192192
    193193    device_path = sa.Column(sa.String(length=255), nullable=True)
    194     enabled = sa.Column(sa.Boolean(), nullable=False, default=True)
     194
     195    enabled = sa.Column(sa.DateTime(), nullable=True, doc="""
     196    This will either be the date/time when the probe was most recently enabled,
     197    or null if it is not currently enabled.  If set, the client will be
     198    expected to take readings for this probe, and the server will monitor them
     199    to ensure they are within the expected range etc.
     200    """)
    195201
    196202    critical_temp_max = sa.Column(sa.Integer(), nullable=False, doc="""
  • rattail_tempmon/problems.py

    rc45baae rf31a0c4  
    3838    clients = tempmon_session.query(tempmon.Client)\
    3939                             .filter(tempmon.Client.archived == False)\
    40                              .filter(tempmon.Client.enabled == False)\
     40                             .filter(tempmon.Client.enabled == None)\
    4141                             .all()
    4242    probes = tempmon_session.query(tempmon.Probe)\
    4343                            .join(tempmon.Client)\
    4444                            .filter(tempmon.Client.archived == False)\
    45                             .filter(tempmon.Client.enabled == True)\
    46                             .filter(tempmon.Probe.enabled == False)\
     45                            .filter(tempmon.Client.enabled != None)\
     46                            .filter(tempmon.Probe.enabled == None)\
    4747                            .all()
    4848    if clients or probes:
  • rattail_tempmon/server.py

    rc45baae rf31a0c4  
    7272        try:
    7373            clients = session.query(tempmon.Client)\
    74                              .filter(tempmon.Client.enabled == True)\
     74                             .filter(tempmon.Client.enabled != None)\
    7575                             .filter(tempmon.Client.archived == False)
    7676            for client in clients:
Note: See TracChangeset for help on using the changeset viewer.