From d4ebc9326cd516e4d78138edb22e3a6d21391475 Mon Sep 17 00:00:00 2001 From: Florian Probst Date: Sat, 7 Jan 2023 14:53:08 +0100 Subject: [PATCH] bugfix journalcrawling not updating unsold value First I thought it wasn't working only when reset but realized that it didn't work regardless. I'll need to go and publish a new release where I'll announce that it is fixed now. --- journalcrawler.py | 6 ++++-- load.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/journalcrawler.py b/journalcrawler.py index 1dabce8..d1561ab 100644 --- a/journalcrawler.py +++ b/journalcrawler.py @@ -321,8 +321,10 @@ def build_biodata_json(logger: any, journaldir: str) -> int: # noqa #CCR001 vistagenomicsprices = getvistagenomicprices() - for element in notsolddata: - unsoldvalue += vistagenomicsprices[element["species"]] + for cmdr in notsolddata.keys(): + for element in notsolddata[cmdr]: + print(element) + unsoldvalue += vistagenomicsprices[element["species"]] logger.info("Done with journalcrawling!") diff --git a/load.py b/load.py index a04d5ea..e2cbcbd 100644 --- a/load.py +++ b/load.py @@ -359,7 +359,7 @@ def on_preferences_closed(self, cmdr: str, is_beta: bool) -> None: config.set("AST_hide_scans_in_system", int(self.AST_hide_scans_in_system.get())) - logger.info(f"Currently last Commander is: {cmdr}") + logger.debug(f"Currently last Commander is: {cmdr}") config.set("AST_last_CMDR", str(cmdr)) @@ -406,7 +406,7 @@ def clipboard(self) -> None: """Copy value to clipboard.""" dummytk = tk.Tk() # creates a window we don't want dummytk.clipboard_clear() - dummytk.clipboard_append(plugin.rawvalue) + dummytk.clipboard_append(self.rawvalue) dummytk.destroy() # destroying it again we don't need another full window everytime we copy to clipboard. def forcehideshow(self) -> None: @@ -717,8 +717,11 @@ def update_last_scan_plant(entry=None): plantname = str(plugin.AST_last_scan_plant.get().split(" (Worth: ")[0]) if entry is not None: plantname = orgi.generaltolocalised(entry["Species"].lower()) - plantworth = vistagenomicsprices[plantname] - worthstring = f"{plantworth:,} Cr." + plantworth = vistagenomicsprices[plantname] + worthstring = f"{plantworth:,} Cr." + else: + plantworth = None + worthstring = "N/A" if plugin.AST_shorten_value.get(): worthstring = shortcreditstring(plantworth) plugin.AST_last_scan_plant.set(plantname + " (Worth: " + worthstring + ")") @@ -1251,6 +1254,8 @@ def build_sold_bio_ui(plugin, cmdr: str, current_row) -> None: # noqa #CCR001 def shortcreditstring(number): """Create string given given number of credits with SI symbol prefix and money unit e.g. KCr. MCr. GCr. TCr.""" + if number is None: + return "N/A" prefix = ["", "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q"] fullstring = f"{number:,}" prefixindex = fullstring.count(",")