Skip to content

herohours modernization attempt? #65

Open
Ruthie-FRC wants to merge 19 commits intoFRC5892:mainfrom
Ruthie-FRC:main
Open

herohours modernization attempt? #65
Ruthie-FRC wants to merge 19 commits intoFRC5892:mainfrom
Ruthie-FRC:main

Conversation

@Ruthie-FRC
Copy link
Member

this is my first attempt to try to clean up herohours. please don't judge me if it sucks. if its good, I take all the credit.

This pull request introduces several improvements and refactorings across the codebase, focusing on Django admin actions, code cleanup, and enhanced documentation. The most significant changes include improved handling of check-in/check-out logic with more robust time calculations, addition of helpful docstrings in WebSocket consumer code, and code cleanup to remove unnecessary print statements and clarify intent.

Django Admin Logic and Features:

  • Improved check-in/check-out logic in HeroHours/admin.py to use a consistent right_now timestamp and Django ORM expressions (F, ExpressionWrapper) for accurate and atomic updates to time-tracking fields. This also ensures that missing Last_In values are handled gracefully. [1] [2]
  • Added the entered field when creating ActivityLog entries during check-in, check-out, and reset actions for more complete audit logging. [1] [2] [3] [4]
  • Improved admin list display by using the @admin.display decorator for clarity and consistency, replacing deprecated short_description and admin_order_field attributes. [1] [2]

Code Cleanup and Refactoring:

  • Removed unnecessary print statements and dead code from HeroHours/admin.py, HeroHours/forms.py, and other files to clean up console output and improve readability. [1] [2] [3] [4]
  • Refactored import statements in HeroHours/admin.py and HeroHours/consumers.py for clarity and to remove unused or redundant imports. [1] [2]

Documentation and Developer Experience:

  • Added detailed docstrings to serializers, WebSocket consumers, and observer methods in HeroHours/consumers.py to clarify their purpose and usage for future developers. [1] [2] [3]
  • Improved help text and argument parsing in the bulk.py management command for better usability and error prevention.

Other Notable Changes:

  • Added a DEBUG configuration variable to .env.example to clarify default environment settings.
  • Fixed CSV export filename formatting in the admin action for consistency.

These changes collectively improve code maintainability, reliability of time-tracking operations, and the developer experience for both current and future contributors.

This migration modifies several fields in the activitylog and users models, including altering field types and adding new indexes for improved query performance.
Reorganize imports and enhance admin actions for clarity.
Added docstrings to MemberSerializer and LiveConsumer classes, as well as update_activity method, to clarify their purposes and usage.
Added validators and improved model fields for Users and ActivityLog.
Refactor views in HeroHours to include type hints and improve code structure. Added rate limiting to specific views and updated variable names for consistency.
Implemented custom throttling classes for SheetPull and MeetingList APIs to limit request rates.
Refactor settings to use Path for file paths and add security settings for production.
Updated several package versions for better compatibility and security.
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