Skip to content

feat: inline chores notifications #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

thisislawatts
Copy link
Contributor

@thisislawatts thisislawatts commented Jul 12, 2025

This branch integrates chore notification functionality that was previously hosted within the Aggregator, into this CRM application. The intention of the migration is to avoid making significant changes to the logic. The changes to the CRM include:

Core Functionality Added:

  • Event Generation: Support for both recurrent (cron-based) and single-occurrence chore events
  • Notification System: Email-based reminder system for volunteers with duplicate prevention
  • Management Command: send_reminders command for processing scheduled notifications. This can be invoked by a cron job to trigger the reminders.

Key Architectural Change:

  • Database-backed Notification Tracking: Introduced ChoreNotification model to replace Redis-based duplicate prevention from the previous implementation. This provides persistent storage and better integration with Django's ORM.

Key Components:

  • chores/core.py (417 lines): Core logic for chore events, time calculations, and notification processing
  • chores/models.py: Database models for chores, volunteers, and notification tracking
  • chores/management/commands/send_reminders.py: Django management command for sending reminders
  • chores/messages.py: Email message templates for volunteer reminders

Dependencies Added:

  • croniter>=6.0.0 - from aggregator for cron-based scheduling
  • humanize>=4.12.3 - from aggregator for human-readable time formatting
  • time-machine>=2.16.0 - For time manipulation in tests
  • factory-boy>=3.3.3 - For test data generation

Minor Changes:

  • Added full_name property to User model in members/models.py
  • Comprehensive test suite with factories and model tests

Impact:

This consolidation eliminates the need for a separate service while maintaining the same functionality for chore scheduling and volunteer notification management. The system supports complex scheduling patterns and prevents duplicate notifications through database tracking instead of Redis, providing better persistence and integration with the Django ecosystem.

This PR introduces the logic, but it will need to be tied into a cron job on the server before it is functional.

Supporting diagrams:

Current implementation in Aggregator
CurrentImplementation

New implementation
NewImplementation

@thisislawatts
Copy link
Contributor Author

Note Commits will be squashed prior to merge

@thisislawatts thisislawatts marked this pull request as ready for review July 13, 2025 06:39
@thisislawatts thisislawatts requested a review from a team July 13, 2025 06:39
@thisislawatts thisislawatts force-pushed the feat/inline-chores-notifications branch from bdce95a to 846825a Compare July 13, 2025 11:39
@thisislawatts thisislawatts force-pushed the feat/inline-chores-notifications branch from 2d1d967 to 8057e58 Compare July 13, 2025 16:51
thisislawatts added a commit to MakerSpaceLeiden/aggregator that referenced this pull request Jul 13, 2025
This functionality is being migrated across to the CRM app
MakerSpaceLeiden/makerspaceleiden-crm#187
thisislawatts added a commit to MakerSpaceLeiden/aggregator that referenced this pull request Jul 13, 2025
This functionality is being migrated across to the CRM app
MakerSpaceLeiden/makerspaceleiden-crm#187
thisislawatts added a commit to MakerSpaceLeiden/aggregator that referenced this pull request Jul 13, 2025
This functionality is being migrated across to the CRM app
MakerSpaceLeiden/makerspaceleiden-crm#187
thisislawatts added a commit to MakerSpaceLeiden/aggregator that referenced this pull request Jul 13, 2025
This functionality is being migrated across to the CRM app
MakerSpaceLeiden/makerspaceleiden-crm#187
thisislawatts added a commit to MakerSpaceLeiden/aggregator that referenced this pull request Jul 13, 2025
This functionality is being migrated across to the CRM app
MakerSpaceLeiden/makerspaceleiden-crm#187
@thisislawatts thisislawatts marked this pull request as draft July 17, 2025 11:59
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