Skip to content

Commit

Permalink
Merge pull request #75 from LCOGT/fix/sstk-images-limited-10
Browse files Browse the repository at this point in the history
Fix/sstk images limited 10
  • Loading branch information
LTDakin authored Dec 21, 2023
2 parents a4f54ce + 3abd958 commit a9f0e83
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,17 @@ def filtered_images_query(db_address: str, query_filters: list):
image_pkgs = filter_img_pkgs_final_sstack(image_pkgs)
return image_pkgs

# Filter smart stacks to reduce the size of ui payload
# Filter out intermediate smart stacks to reduce the size of ui payload
def filter_img_pkgs_final_sstack(image_pkgs):
# dict containing max stknum for each unique smartstack
max_sstk_nums = {}

for img_pkg in image_pkgs:
if not img_pkg.get('SSTKNUM', 0).isdigit():
continue

smart_stk = img_pkg.get('SMARTSTK')
sstk_num = int(img_pkg.get('SSTKNUM'), 0)
sstk_num = int(img_pkg.get('SSTKNUM', 0))

if smart_stk is None or smart_stk == 'no':
continue
Expand All @@ -312,6 +315,7 @@ def filter_img_pkgs_final_sstack(image_pkgs):
if img_pkg.get('SMARTSTK') is None
or img_pkg.get('SSTKNUM') is None
or img_pkg.get('SMARTSTK') == 'no'
or not img_pkg.get('SMARTSTK').isdigit()
or int(img_pkg.get('SSTKNUM', 0)) >= max_sstk_nums.get(img_pkg.get('SMARTSTK'), 0)
]

Expand Down

0 comments on commit a9f0e83

Please sign in to comment.