Skip to content

feat: Implement CRUD management for absence codes#27

Merged
PPeitsch merged 13 commits into
mainfrom
feature/crud-absence-codes
Aug 8, 2025
Merged

feat: Implement CRUD management for absence codes#27
PPeitsch merged 13 commits into
mainfrom
feature/crud-absence-codes

Conversation

@PPeitsch
Copy link
Copy Markdown
Owner

@PPeitsch PPeitsch commented Aug 7, 2025

Description

This pull request introduces a full CRUD (Create, Read, Update, Delete) management system for absence codes, making the application significantly more flexible and adaptable to real-world use cases. The static, hardcoded list of absence types has been replaced with a dynamic, user-configurable system.

Key components of this feature include:

  1. New Settings Page: A new management interface has been created at /settings/absences. Users can now add, edit, and delete their own custom absence codes through an interactive, asynchronous UI.
  2. Backend API: A new settings blueprint provides a set of RESTful API endpoints to handle all CRUD operations for AbsenceCode records. The API includes robust validation and error handling, such as preventing the creation of duplicate codes and the deletion of codes that are currently in use.
  3. Dynamic Integration:
    • The dropdown menu in the "Manual Entry" form is now dynamically populated from the database, ensuring it always reflects the user's custom list of codes.
    • The "Calendar Log" view has been updated to consume the new centralized API endpoint for absence codes.
  4. Comprehensive Testing: A new test suite, tests/test_settings.py, has been added, providing 100% code coverage for all new backend logic and ensuring the reliability of the CRUD operations.

This feature is a major step towards making TimeTrack a production-ready tool.

Type of Change

  • New feature
  • Refactoring
  • Test coverage

Testing

  • Added a new test file, tests/test_settings.py, with complete coverage for the new settings blueprint.
  • Tested all API endpoints for successful operations (GET, POST, PUT, DELETE) and error handling (conflicts, not found, invalid payloads, DB errors).
  • Manually verified the entire user flow:
    • Navigated to the new "Settings" page.
    • Successfully created, renamed, and deleted absence codes.
    • Verified that changes made in Settings are immediately reflected in the dropdowns of both the "Manual Entry" form and the "Calendar Log" modal.
    • Confirmed that attempting to delete a code currently in use displays a user-friendly error message.
  • Ran the full existing test suite to ensure no regressions were introduced.

Checklist

  • I have followed the project's code style (Black, isort, PEP 8)
  • My code generates no new warnings
  • I have added tests for new functionality
  • All tests pass locally
  • I have updated the documentation where necessary (Changelog updated)
  • I have run pre-commit hooks before submitting

Fixes #6

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
app/__init__.py 100.00% <100.00%> (ø)
app/routes/manual_entry.py 72.41% <100.00%> (ø)
app/routes/monthly_log.py 100.00% <ø> (ø)
app/routes/settings.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PPeitsch PPeitsch changed the title Feature/crud absence codes feat: Implement CRUD management for absence codes Aug 8, 2025
@PPeitsch PPeitsch merged commit 5d2ac7a into main Aug 8, 2025
2 checks passed
@PPeitsch PPeitsch deleted the feature/crud-absence-codes branch August 8, 2025 01:06
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.

⚡ [Feature]: Implement CRUD management for absence codes

1 participant