Skip to content

Commit

Permalink
bugfix journalcrawling not updating unsold value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Balvald committed Jan 7, 2023
1 parent bb1a1dd commit d4ebc93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions journalcrawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")

Expand Down
13 changes: 9 additions & 4 deletions load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 + ")")
Expand Down Expand Up @@ -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(",")
Expand Down

0 comments on commit d4ebc93

Please sign in to comment.