mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: sample: fix annulled state computation (2)
This commit is contained in:
parent
31f6bddf40
commit
48da1207b4
|
@ -3352,10 +3352,20 @@ class Sample(ModelSQL, ModelView):
|
|||
'INNER JOIN "' + Fraction._table + '" f '
|
||||
'ON f.id = s.fraction '
|
||||
'WHERE f.sample = %s '
|
||||
'AND nl.annulled = FALSE',
|
||||
'AND nl.annulled = TRUE',
|
||||
(self.id,))
|
||||
if cursor.fetchone()[0] == 0:
|
||||
return 'annulled'
|
||||
annulled_lines = cursor.fetchone()[0]
|
||||
if annulled_lines > 0:
|
||||
cursor.execute('SELECT COUNT(*) '
|
||||
'FROM "' + NotebookLine._table + '" nl '
|
||||
'INNER JOIN "' + Service._table + '" s '
|
||||
'ON s.id = nl.service '
|
||||
'INNER JOIN "' + Fraction._table + '" f '
|
||||
'ON f.id = s.fraction '
|
||||
'WHERE f.sample = %s',
|
||||
(self.id,))
|
||||
if cursor.fetchone()[0] == annulled_lines:
|
||||
return 'annulled'
|
||||
if self.laboratory_end_date:
|
||||
return 'lab_pending_acceptance'
|
||||
if self.laboratory_start_date:
|
||||
|
|
Loading…
Reference in a new issue