diff options
| author | Magnus Hagander | 2018-02-26 13:34:29 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2018-02-26 13:34:29 +0000 |
| commit | 9d29bb2e18780d2d5a79df0ab74d8d91ead4091c (patch) | |
| tree | 6fd39a17ea2690e1e1bade6eb908fd33c1abb528 /postgresqleu/util/db.py | |
| parent | 2669a9e1c48a1463ce0fab62144e86fd9e6be216 (diff) | |
Alert for sessions in Submitted state when schedule is public
We can't start alerting for sessions in submitted state all the time,
but once the schedule is public there should be no sessions in this
state (they should either be rejcted or pending), so highlight the
button at this time to make it clear.
Diffstat (limited to 'postgresqleu/util/db.py')
| -rw-r--r-- | postgresqleu/util/db.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/postgresqleu/util/db.py b/postgresqleu/util/db.py index 05d30b7d..93093938 100644 --- a/postgresqleu/util/db.py +++ b/postgresqleu/util/db.py @@ -25,6 +25,12 @@ def exec_to_scalar(query, params=None): # If the query returns no rows at all, then just return None return None +def conditional_exec_to_scalar(condition, query, params=None): + if condition: + return exec_to_scalar(query, params) + else: + return False + def exec_to_keyed_dict(query, params=None): curs = connection.cursor() curs.execute(query, params) |
