Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/ManualClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,16 @@ def build_tracker_and_locations_table(self):
self.listed_locations["(No Category)"].append(location_id)

victory_location = self.ctx.goal_location
victory_categories = set()
victory_categories = set(victory_location.get("category", []))

if "category" in victory_location and len(victory_location["category"]) > 0:
for category in victory_location["category"]:
if category not in self.location_categories:
self.location_categories.append(category)
for category in victory_categories:
if category not in self.location_categories:
self.location_categories.append(category)

if category not in self.listed_locations:
self.listed_locations[category] = []
victory_categories.add(category)

if not victory_categories:
if category not in self.listed_locations:
self.listed_locations[category] = []

if len(victory_categories) == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you're using len() == 0 instead of not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stemmed from a misunderstanding of how for-else works in Python, which I originally did for the for loop above. In my head, for-else would do the for if there are any iterations and do the else if no iterations. In actuality, Python just like... does both if you don't break the loop. Which is kinda goofy, lol

I can change it to not 😄

victory_categories.add("(No Category)")

for category in self.listed_locations:
Expand Down Expand Up @@ -556,8 +554,8 @@ def build_tracker_and_locations_table(self):
for location_category in sorted(self.listed_locations.keys()):
locations_in_category = len(self.listed_locations[location_category])

if ("category" in victory_location and location_category in victory_location["category"]) or \
("category" not in victory_location and location_category == "(No Category)"):
if (location_category in victory_categories) or \
(len(victory_categories) == 0 and location_category == "(No Category)"):
locations_in_category += 1

category_tree = locations_panel.add_node(
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def __init__(self, display_name: str, script_name: Optional[str] = None, func: O
self.version = version

def add_client_to_launcher() -> None:
version = 2024_11_22 # YYYYMMDD
version = 2024_12_13 # YYYYMMDD
found = False

if "manual" not in icon_paths:
Expand Down