diff --git a/code.json b/code.json index e9ac180..0c896ac 100644 --- a/code.json +++ b/code.json @@ -3,7 +3,7 @@ "name": "liliservices", "organization": "U.S. Geological Survey", "description": "Web services for LILI (LIDE (Laboratory for Infectious Disease and the Environment) Information Management System)", - "version": "v1.2.1", + "version": "v1.2.2", "status": "Production", "permissions": { @@ -47,7 +47,7 @@ }, "date": { - "metadataLastUpdated": "2020-04-28" + "metadataLastUpdated": "2020-04-29" } } ] diff --git a/liliapi/models.py b/liliapi/models.py index 70a43c4..ad5af48 100644 --- a/liliapi/models.py +++ b/liliapi/models.py @@ -511,11 +511,10 @@ def get_next_empty_box(self, last_spot): cur_box = last_spot.box while cur_rack <= last_spot.freezer.racks: while cur_box <= last_spot.freezer.boxes: - # get the initial spot in the box - first_spot = self.filter( - freezer=last_spot.freezer.id, rack=cur_rack, box=cur_box, row=1, spot=1).first() - # if this box is empty (does not exit), return it, otherwise continue to the next box - if not first_spot: + # check if this box exists (meaning the actual physical box is empty) + cur_box_occupied = self.filter(freezer=last_spot.freezer.id, rack=cur_rack, box=cur_box) + if not cur_box_occupied: + # if this box is empty (does not exit), return it, otherwise continue to the next box next_empty_box['rack'] = cur_rack next_empty_box['box'] = cur_box next_empty_box['row'] = 1