diff --git a/docs/changelog.rst b/docs/changelog.rst index d1a3bd5..e432c63 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,7 @@ Changelog 1.1.0 (unreleased) ------------------ +- #25 Do not allow to "submit" AST analyses with no result save - #23 Fix AST calculation does not work when extrapolated antibiotics - #22 Hide Unit and display Submitter before Captured in AST entry - #21 Fix AST entry is empty when analyses categorization for sample is checked diff --git a/src/senaite/ast/adapters/guards.py b/src/senaite/ast/adapters/guards.py index c679df0..d8ad495 100644 --- a/src/senaite/ast/adapters/guards.py +++ b/src/senaite/ast/adapters/guards.py @@ -89,20 +89,26 @@ def guard_submit(self): # Not an AST analysis return True - # Check that all interim fields have non-empty values - keyword = self.context.getKeyword() - for interim in self.context.getInterimFields(): + # Get the antibiotics (as interim fields) + antibiotics = self.context.getInterimFields() + if not antibiotics: + return False - if utils.is_extrapolated_interim(interim): - # Skip extrapolated interims + keyword = self.context.getKeyword() + for antibiotic in antibiotics: + if utils.is_extrapolated_interim(antibiotic): + # Skip extrapolated antibiotics continue + if utils.is_interim_empty(antibiotic): + # Cannot submit if no result + return False + if keyword in [ZONE_SIZE_KEY, DISK_CONTENT_KEY]: # Negative values are not permitted - value = interim.get("value") + value = antibiotic.get("value") value = api.to_float(value, default=-1) if value < 0: return False - # No empties return True