I'd either split it into several functions where we can pass the bag_id to. This would be more performant if one only would need the stack info of one bag.
Or let it accept a table parameter where we can add each bagId we want to check and if no parameter is given return all like today, maybe?
|