Skip to content

Commit

Permalink
Merge branch '1.x' of github.com:senaite/senaite.referral into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
xispa committed Dec 12, 2024
2 parents 7876d71 + e23281d commit aa6b9bb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/senaite/referral/adapters/guards/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ def guard_ship(self):
all analyses from the sample are in unassigned status
"""
allowed = ["unassigned"]
analyses = self.context.getAnalyses(full_objects=True)
valid = map(lambda an: api.get_review_status(an) in allowed, analyses)
return all(valid)
detached = ["cancelled", "rejected", "retracted"]
for analysis in self.context.getAnalyses(full_objects=True):
status = api.get_review_status(analysis)
if status in detached:
# skip analyses in detached status
continue
if status not in allowed:
# all analyses must be in "unassigned" status
return False
return True

def guard_reject_at_reference(self):
"""Returns true if the sample can be transitioned to rejected at
Expand Down

0 comments on commit aa6b9bb

Please sign in to comment.