Skip to content

fix(accounts): remove sleeping members from future shifts/rides and notify coordinators#416

Open
tobiascadee wants to merge 9 commits intomainfrom
fix/287-sleeping-members-handling
Open

fix(accounts): remove sleeping members from future shifts/rides and notify coordinators#416
tobiascadee wants to merge 9 commits intomainfrom
fix/287-sleeping-members-handling

Conversation

@tobiascadee
Copy link
Copy Markdown
Collaborator

Fixes #287

Summary

  • When a member is set to sleeping (is_asleep=True), they are now automatically removed from all future distribution shifts via the M2M relationship
  • For rides (where driver/codriver are non-nullable FKs), the transport coordinator is notified so they can arrange a replacement manually
  • Email notifications are sent to the relevant coordinator (distribution coordinator for shifts, transport coordinator for rides); falls back to mail_admins if no coordinator is assigned

Implementation

A pre_save signal on VokoUser detects when is_asleep transitions from False to True and triggers the cleanup + notifications. Uses apps.get_model() to avoid circular imports between accounts, distribution, and transport.

Test plan

  • Member is removed from future shifts when set to sleeping
  • Member is NOT removed from past shifts
  • Distribution coordinator is notified by email when member is removed from a shift
  • Admins are notified when no coordinator is assigned to a shift
  • Transport coordinator is notified when sleeping member is a ride driver
  • Transport coordinator is notified when sleeping member is a ride co-driver
  • Admins are notified when no coordinator is assigned to a ride
  • No duplicate notifications when a member is already sleeping and saved again
  • No notifications when a member is woken up (is_asleep set back to False)

🤖 Generated with Claude Code

tobiascadee and others added 8 commits December 8, 2025 22:26
BREAKING CHANGES:
- Python version upgraded from 3.8 to 3.11
- Django version upgraded from 3.2.25 to 4.2.x

Migration changes:
- Replace deprecated django.conf.urls.url() with django.urls.path/re_path
- Replace deprecated ugettext_lazy with gettext_lazy
- Replace django-recaptcha's captcha module with django_recaptcha
- Replace mock library with unittest.mock (built-in)
- Remove USE_L10N setting (deprecated in Django 4.0, removed in 5.0)

Test framework migration:
- Migrate from django-nose to pytest-django
- Add conftest.py for pytest configuration
- Update test commands in Makefile and README
- Remove DisableMigrations hack (no longer needed)

Dependency updates:
- django-bootstrap5: 23.3 → 24.3+
- django-braces: 1.14.0 → 1.16.0+
- django-constance: 2.9.1 → 3.1.0+ (removed [database] extra)
- django-debug-toolbar: 3.8.1 → 4.4.0+
- django-extensions: 3.1.2 → 3.2.3+
- django-hijack: 3.2.6 → 3.4.5+
- django-picklefield: 2.1.1 → 3.1+
- django-recaptcha: 3.0.0 → 4.0.0+
- django-tinymce: 4.1.0 → 4.1.0+
- factory-boy: 3.2.1 → 3.3.0+
- gunicorn: 22.0.0 → 22.0.0+

Removed dependencies:
- django-nose (replaced with pytest-django)
- nose
- mock (use stdlib unittest.mock)
- fake-factory

Code quality:
- Fix class-level queryset evaluation in views (use get_queryset method)
- Fix GroupmanagerFormView to use get_group_pk() for lazy config access
- Apply code formatting consistency throughout codebase

Infrastructure:
- Update Dockerfile base image from python:3.8-bullseye to python:3.11-bookworm
- Update .python-version to 3.11
The empty tests.py placeholder conflicted with the tests/ package,
causing pytest import mismatch errors in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…otify coordinators

When a member is set to sleeping (is_asleep=True), they are now automatically
removed from future distribution shifts and the relevant coordinator is notified
by email. For rides, where driver/codriver are non-nullable FKs, the transport
coordinator is notified so they can arrange a replacement.

Fixes #287

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Base automatically changed from feature/upgrade-python-and-dependencies to main March 5, 2026 19:36
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.

2 participants