Skip to content

Expense_Tracker_fixes#443

Open
Sandhiya-003 wants to merge 1 commit into
ndleah:mainfrom
Sandhiya-003:feature/expense-tracker-fixes
Open

Expense_Tracker_fixes#443
Sandhiya-003 wants to merge 1 commit into
ndleah:mainfrom
Sandhiya-003:feature/expense-tracker-fixes

Conversation

@Sandhiya-003

Copy link
Copy Markdown

Description

This PR significantly enhances the basic ExpenseTracker script by fixing category tracking logic and introducing robust features like data persistence, input validation, budgeting limits, comprehensive search/filtering, and CSV exporting. It also refactors the code structure to follow Python best practices.

Fixes & Enhancements

  • Bug Fixes: Corrected the category logic so that viewing categories dynamically reads and displays all added categories rather than just relying on active expenses.
  • Data Persistence: Added save_data() and load_data() using a local JSON file (expenses_data.json) so user data survives application restarts.
  • Input Validation: Implemented strict format checks for dates (YYYY-MM-DD with an option to default to today's date) and forced numeric validation for expense amounts to prevent system crashes.
  • Budget Tracking: Added optional budget limits per category, featuring proactive warnings at 80% usage and alerts when limits are exceeded.
  • CRUD Operations: Users can now seamlessly edit or delete specific expenses, as well as clear entire categories with confirmation prompts.
  • Advanced Reporting & Search: Added powerful filters (by category, date range, or description keywords), monthly summaries, and visual CLI bar charts.
  • Data Export: Integrated an export_to_csv() feature to export logs into spreadsheet-ready files.
  • UI/UX Refactor: Upgraded the command-line interface with clean box-drawn menus, emoji indicators, aligned data tables, and structured the runtime logic using a standard if __name__ == "__main__": guard.

How to Test

  1. Run the script: python expense_tracker.py
  2. Try adding an expense with an invalid date format or text for the amount to verify the validation loops.
  3. Add a category budget limit and log expenses to trigger the 80% and 100% threshold alerts.
  4. Close the application and restart it to verify that data correctly reloads from expenses_data.json.
  5. Run the CSV export option and check the generated file.

Checklist

  • Code follows the style guidelines of this project
  • My modifications do not break existing base functionality
  • I have tested the script thoroughly locally
  • Documented all new functions and methods with clean docstrings

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant