Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Fix bug in get next available freezer location where first spot was e…
Browse files Browse the repository at this point in the history
…mpty but other spots in the box were occupied (ensure that only empty boxes are returned)
  • Loading branch information
aaronstephenson committed Apr 29, 2020
1 parent 8f8f8bc commit 4899b81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions code.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -47,7 +47,7 @@
},

"date": {
"metadataLastUpdated": "2020-04-28"
"metadataLastUpdated": "2020-04-29"
}
}
]
9 changes: 4 additions & 5 deletions liliapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4899b81

Please sign in to comment.