-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/add category support #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds full support for category management by extending the data handler, updating front-end routes/templates, and expanding test coverage.
- Refactor data handler: improved
read_database, addedadd_category/get_categories, revisedget_users - Enhance front-end: session-based user selection, new
/select_userand/submit_categoryroutes with validation - Expand tests: isolated test DB fixture, new tests for category methods and edge cases
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/tests/test_data_handler.py | Extend fixture for isolated DB; add tests for execute_sql, read_database, add_category, get_categories, and edge cases |
| src/front/home.py | Update home_page to use session data; add select_user & submit_category routes with validation and feedback |
| src/data_handler.py | Remove old read_database; add new read_database signature; implement add_category, get_categories; update get_users |
Files not reviewed (1)
- src/front/templates/home.html: Language not supported
Comments suppressed due to low confidence (2)
src/front/home.py:57
- [nitpick] Inconsistent message casing: consider capitalizing the first letter (e.g., "User name saved!") for consistency with other flash messages.
flash("user name saved! Now select the user from the dropdown to continue.", "success")
src/data_handler.py:163
- [nitpick] This public method lacks a docstring. Adding a brief description of its behavior and return format will improve clarity.
def get_users(self) -> list:
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Jake-Pullen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall amazing progress. There is some comments to address and overall i'd like to see more logging and some minor formatting cleanup (suggest letting a linter change files on save, will fix whitespace on blank lines | trailing whitespace | blank lines count between functions)
…ature/add-category-support
…mprove database methods and tests
* Some initial changes based on feedback * More additions * Resolved most comments from Pull Request 8 * Moved convert to universal currency to its own module. * Working towards adding default rows, need to add system user? * feat: ✨We now add an internal master category per user that is hidden Will be useful for various key restraints. * fix: 🩹 Fixed a test failure --------- Co-authored-by: Jake Pullen <hello@jake-is.me>
This pull request introduces significant updates to the
data_handlermodule, the front-end logic for user and category management, and the associated test cases. Key changes include refactoring the database interaction methods, adding support for category management, enhancing the front-end to handle user and category selection, and expanding test coverage. Below are the most important changes grouped by theme:Database Interaction Enhancements:
read_databaseto support parameterized queries and return results as a list. This method was moved and improved to handle SQL execution more robustly.add_categoryandget_categoriesmethods to manage categories in the database, including support for optional budget values and parent categories.Front-End Updates:
home.htmltemplate to include forms for selecting users, adding categories, and displaying categories. Added dynamic dropdowns and validation for user and category inputs.home_pagefunction to fetch categories for the selected user and pass them to the template for rendering./select_userand/submit_category) to handle user selection and category creation, with appropriate session management and error handling.Code Refactoring:
read_databasemethod and replaced its usage with the new implementation. Simplified logging and error handling inadd_user_name.Test Coverage Improvements:
add_category,get_categories) and enhanced existing tests to validate database interactions, including parameterized queries and edge cases.These changes collectively improve the maintainability, functionality, and testability of the application while introducing new features for category management.