Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

Conversation

@AtomicAlexD
Copy link
Collaborator

This pull request introduces significant updates to the data_handler module, 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:

  • Refactored read_database to support parameterized queries and return results as a list. This method was moved and improved to handle SQL execution more robustly.
  • Added add_category and get_categories methods to manage categories in the database, including support for optional budget values and parent categories.

Front-End Updates:

  • Updated the home.html template to include forms for selecting users, adding categories, and displaying categories. Added dynamic dropdowns and validation for user and category inputs.
  • Enhanced the home_page function to fetch categories for the selected user and pass them to the template for rendering.
  • Added new routes (/select_user and /submit_category) to handle user selection and category creation, with appropriate session management and error handling.

Code Refactoring:

  • Removed the old read_database method and replaced its usage with the new implementation. Simplified logging and error handling in add_user_name.

Test Coverage Improvements:

  • Added comprehensive test cases for new methods (add_category, get_categories) and enhanced existing tests to validate database interactions, including parameterized queries and edge cases.
  • Introduced a test-specific database setup and teardown mechanism to ensure isolated and repeatable tests.

These changes collectively improve the maintainability, functionality, and testability of the application while introducing new features for category management.

@AtomicAlexD AtomicAlexD requested a review from Copilot May 28, 2025 15:38
Copy link
Contributor

Copilot AI left a 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, added add_category/get_categories, revised get_users
  • Enhance front-end: session-based user selection, new /select_user and /submit_category routes 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:

@Jake-Pullen Jake-Pullen self-assigned this May 29, 2025
Copy link
Owner

@Jake-Pullen Jake-Pullen left a 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)

@Jake-Pullen Jake-Pullen added the enhancement New feature or request label Jun 1, 2025
@Jake-Pullen Jake-Pullen added this to the MVP milestone Jun 1, 2025
* 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>
@Jake-Pullen Jake-Pullen dismissed their stale review June 28, 2025 07:02

reset for recent merge

@Jake-Pullen Jake-Pullen merged commit 50a2103 into stage Jun 28, 2025
@Jake-Pullen Jake-Pullen deleted the feature/add-category-support branch June 28, 2025 08:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants