From f3c4b67d7e658b93f47ecd8ee97e232925e147e0 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Sat, 17 Jun 2023 09:40:45 -0700 Subject: [PATCH] Fix issue of nowhere to buy a material (mainly for mineables) --- app/star_citizen.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/star_citizen.py b/app/star_citizen.py index c35e5b84..955cb1f2 100755 --- a/app/star_citizen.py +++ b/app/star_citizen.py @@ -238,15 +238,16 @@ async def calculate_trade_profies(commodity, scu=None): costs[station] = trades["buy"][commodity] * int(scu) break - embed.add_field( - name="**Best place to buy %s of %s**" % (scu_string, commodity), - value="%s: $%s" - % ( - min(costs, key=costs.get), - "{:20,.2f}".format(costs[min(costs, key=costs.get)]).strip(), - ), - inline=True, - ) + if len(costs): + embed.add_field( + name="**Best place to buy %s of %s**" % (scu_string, commodity), + value="%s: $%s" + % ( + min(costs, key=costs.get), + "{:20,.2f}".format(costs[min(costs, key=costs.get)]).strip(), + ), + inline=True, + ) # Same logic, but finding the place buying the commodity for the most profits = {}