Guidelines

This commit is contained in:
Bertrand Chenal
2008-06-11 19:37:21 +02:00
parent 8b88de774b
commit d10c6443fa
+4 -1
View File
@@ -37,9 +37,12 @@ class Statement(OSV):
]
def check_unique_waiting_statement(self, cursor, user, ids, parent=None):
"""Ensure that only one statement is in waiting state
for a given journal"""
cursor.execute('SELECT max(nb_waiting) AS max_nb_waiting '\
'FROM (SELECT count(\'\') AS nb_waiting '\
'FROM statement_statement WHERE state = \'waiting\' '\
'FROM statement_statement '\
'WHERE state = \'waiting\' '\
'GROUP BY company, journal) AS sub_query')
if cursor.rowcount and cursor.fetchone()[0] > 1:
return False