Skip to content

Commit

Permalink
Fix for smart stacks only displaying up to 10 in ui
Browse files Browse the repository at this point in the history
sstknum was being treated as a string, cast it as an int for proper
comparisons.
  • Loading branch information
LTDakin committed Dec 21, 2023
1 parent 817570f commit 4198a9b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ def filtered_images_query(db_address: str, query_filters: list):
session.expunge_all()
image_pkgs = [image.get_image_pkg() for image in images]
image_pkgs = filter_img_pkgs_final_sstack(image_pkgs)
# Debugging statement for cloudwatch logs
sstk_list = [(img_pkg["SMARTSTK"], img_pkg["SSTKNUM"]) for img_pkg in image_pkgs if img_pkg.get('SMARTSTK') is not None or img_pkg.get('SMARTSTK') != 'no']
print("DEBUG: filtered list of smart stacks ", sstk_list)
return image_pkgs

# Filter smart stacks to reduce the size of ui payload
Expand All @@ -301,7 +298,7 @@ def filter_img_pkgs_final_sstack(image_pkgs):

for img_pkg in image_pkgs:
smart_stk = img_pkg.get('SMARTSTK')
sstk_num = img_pkg.get('SSTKNUM')
sstk_num = int(img_pkg.get('SSTKNUM'), 0)

if smart_stk is None or smart_stk == 'no':
continue
Expand All @@ -315,7 +312,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 img_pkg['SSTKNUM'] >= max_sstk_nums.get(img_pkg.get('SMARTSTK'), 0)
or int(img_pkg.get('SSTKNUM', 0)) >= max_sstk_nums.get(img_pkg.get('SMARTSTK'), 0)
]

return filtered_arr
Expand Down

0 comments on commit 4198a9b

Please sign in to comment.