fix: transform xp to 0 if currently None for main pokemon#309
fix: transform xp to 0 if currently None for main pokemon#309MrElektronz wants to merge 2 commits intoh0tp-ftw:mainfrom
Conversation
Summary of ChangesHello @MrElektronz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug where the main Pokémon's experience points ( Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the issue where the xp attribute of the main Pokémon could be None, leading to errors during gameplay and when opening the Ankimon window. The changes ensure that xp defaults to 0 in the configuration, during object initialization, and as a safeguard when saving. The addition of type hints to update_main_pokemon improves code clarity and maintainability. I have identified one minor redundancy in the PokemonObject constructor.
|
this might be a duplicate of #300 ? |
Yep good catch, the other PR should also fix the underlying issue fixed here :D |
Issue posted on discord: https://discord.com/channels/1241773562629718148/1475088305392451656
After updating from the current version from ankiweb to the 1.52-E release I got the following issue after every reviewed card and when trying to open the "Ankimon Window".
The issue was that my main-pokemon had an "xp" attribute of None.
This got fixed in the
save_main_pokemonfunction. If the main pokemon has None xp this gets overwritten to 0 now.I also added some nice touches, such as adding the return value of
update_main_pokemon. If this is not desired in this project I can remove it, but it adds more readability and thus maintainability imo.