Skip to content

AM-1134 waste: manual notification by route name - #235

Open
fhaver-amsterdam wants to merge 3 commits into
mainfrom
waste/am-1134-notifications-split
Open

AM-1134 waste: manual notification by route name#235
fhaver-amsterdam wants to merge 3 commits into
mainfrom
waste/am-1134-notifications-split

Conversation

@fhaver-amsterdam

Copy link
Copy Markdown
Contributor

Changes

Affected services

  • core
  • waste

Definition of done

  • API is backwards compatible (make openapi-diff)
  • Swagger UI up-to-date & tested (make dev)
  • Dependencies updated (make requirements)
    - [ ] Infrastructure config updated (aapp_azure_infra)
    - [ ] Loadtests for relevant endpoints (aapp_testing_loadtests)

After PR created (and deployed on dev):

  • Manual check on dev (o) e.g. use feature via Swagger or admin panel
  • Sanity check on test app (check that dev environment is selected)

Other notes

GitHub Copilot was used in writing the code

@fhaver-amsterdam
fhaver-amsterdam requested review from a team and a lite review from Copilot August 21, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support in the waste service for sending manual push notifications to a subset of users selected by waste collection route name, by introducing route selection on ManualNotification and resolving recipients via the Waste Guide API + bag IDs. This extends existing manual notification functionality while keeping the default behavior (“send to all”) when no routes are selected.

Changes:

  • Add affected_routes selection to ManualNotification and expose it in the Django admin UI + confirmation template.
  • Update ManualNotificationService to resolve device IDs via route name → bag IDs (Waste Guide API) → device IDs.
  • Add/extend tests for route-scoped manual notifications and bag-id/device-id lookup.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
waste/services/notification.py Implements route-filtered recipient lookup for manual notifications via Waste Guide pagination.
waste/models.py Adds affected_routes M2M on ManualNotification and ensures route-name model is available for selection.
waste/migrations/0010_manualnotification_affected_routes.py Adds migration for the new affected_routes field.
waste/admin/notification_admin.py Enables route selection in admin and displays selected routes on the confirmation screen.
core/templates/admin/notification_confirm_send.html Renders the selected route list in the confirmation template.
core/services/waste_device.py Adds lookup helper get_device_ids_for_bag_ids.
core/tests/services/test_waste_device.py Tests the new waste-device lookup helper and ensures device creation behavior.
waste/tests/services/test_notification.py Adds coverage for route-scoped manual notifications and bag-id pagination behavior.
requirements.txt Updates pinned dependencies export.
uv.lock Updates lockfile with newer dependency versions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +51 to +53
class ManualNotificationService(
AbstractNotificationService, WasteCollectionAbstractService
):
Comment on lines +83 to 89
device_ids = notification_service.get_device_ids(obj)
context = {
**self.admin_site.each_context(request),
"nr_sessions": len(device_ids),
"notification": obj,
"affected_routes": self.affected_routes_display(obj),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants