Skip to content

Fixed issue with certain types not in sets - #150

Open
wasup-c wants to merge 2 commits into
devfrom
fix/discoverhandler
Open

Fixed issue with certain types not in sets#150
wasup-c wants to merge 2 commits into
devfrom
fix/discoverhandler

Conversation

@wasup-c

@wasup-c wasup-c commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

added a loop to check if the randomized function provided valid data otherwise it loops until it does

@wasup-c wasup-c added the fix label Nov 12, 2024
@wasup-c
wasup-c requested a review from TelloViz November 12, 2024 19:53
@wasup-c wasup-c self-assigned this Nov 12, 2024
@wasup-c

wasup-c commented Nov 12, 2024

Copy link
Copy Markdown
Contributor Author

i just commented out the previous code, will be cleaned up after you test it out

@wasup-c

wasup-c commented Nov 12, 2024

Copy link
Copy Markdown
Contributor Author

Screenshot from 2024-11-12 11-12-06

@TelloViz TelloViz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

General Feedback:

Without testing it myself, the logic looks sound overall.

  • Please avoid commenting out old code. Instead of replacing the existing code entirely, write your new logic around it. Commenting out old code can clutter the file and make the git history harder to follow. It's better to preserve the original code and build upon it if necessary.
  • Complete the docstrings when updating them. If you're updating docstrings, make sure to finish them properly. Also, it’s best to focus on one task at a time. Changing things across the entire file (e.g., docstrings, code, formatting) can create difficulties when merging later, especially if multiple changes are spread throughout the file.

Because of the commented-out code, I'm rejecting this PR for now. Please revise accordingly and resubmit.

Comment thread CardCollection/discoverhandler.py Outdated
# result = [random.choice(items) for items in category_dict.values()]

# return result

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why is everything above this line commented out?

If it's for experimentation, the whole point of using git is to track different versions and iterations of your code. You don't need to comment things out; git allows you to revert to previous versions and manage isolated changes. Commenting out code can also make it harder to understand the code's history.

Please avoid submitting files with commented-out old code.

Most teams or projects will reject files with unnecessary commented code, as it clutters the codebase.

Don't replace code by commenting it out and pasting in a copy.

Doing so will obscure the git history of those lines, making it hard to see who contributed them. While this may be an oversight, it could be seen as problematic or even malicious by other developers. You're essentially overwriting their attribution.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

my appologies, still getting used to using git and having multiple branches. noted for next time

Comment thread CardCollection/discoverhandler.py Outdated
results = Backend.query_api(self, query)
# Check if the selected type is available within the selected set
query = Backend.construct_query(self, randomSelect)
print("Query: " + query)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove. No need to print to console except when debugging. We can remove this.

Comment thread CardCollection/discoverhandler.py Outdated
randomChoice.append(random.choice(processed_cards))
# If no cards found, the loop will repeat to try a new random selection
if not processed_cards:
print("No cards found for this set/type combination. Retrying...")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove. No need to print to console except for debugging. Not for final code. If wanting to print a meaningful message that is more error handling directed you should use try catch statements that form a meaningful exception object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will remove comments and re-submit branch. those were left so you could test for yourself

@wasup-c

wasup-c commented Nov 13, 2024

Copy link
Copy Markdown
Contributor Author

i dont know if i need to delete the other commit, but i updated it with the requested changes

@wasup-c

wasup-c commented Nov 13, 2024

Copy link
Copy Markdown
Contributor Author

only thing i am unsure of is the un-finished doc strings? i updated it with saying it will loop until a valid card is found? do i need more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants