Offers: deleting an offer leaves its answer-by reminder outstanding, and it is still announced #444

Closed
opened 2026-10-01 10:46:45 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the offer model and views and checking the result with a unit test against the snapshot.

Related to #237.

Checked again on 2026-10-01 against main at 0a5cad587: still present. The code is now at applications/views.py:1364-1375 (OfferDeleteView); applications/models.py and applications/services.py have not moved, and the same unit test gives the same result. The reminders page has since become the calendar's agenda (#316), so the calendar is where the reminder stays.

Recording an offer with an answer-by date makes a reminder ("Answer … about their offer by …"). Deleting the offer does nothing to it: the reminder stays outstanding on the calendar and on the application's page, and the scheduler announces it through the person's notifiers the day before a date that belongs to an offer that no longer exists.

  • Where: applications/views.py:1324-1335 (OfferDeleteView, a plain DeleteView), applications/models.py:972-979 (Offer.reminder, OneToOneField(..., on_delete=models.SET_NULL)), applications/services.py:645-679 (_remind_to_answer, which makes the reminder).
  • What happens: on_delete=SET_NULL protects the offer when its reminder is deleted; it says nothing about the reminder when the offer is deleted. OfferDeleteView has no form_valid of its own and there is no post_delete receiver for Offer (the only ones are in documents/signals.py and jobs/signals.py). Checked: an offer with answer_by a week out, deleted through applications:offer_delete; the reminder was still there with done_at None and due the day before at 09:00.
  • Why it matters: an offer recorded by mistake, or on the wrong application, keeps prompting the person to answer it. _remind_to_answer already ticks the reminder off when the date is taken away; deleting the offer is the same case.
  • Fix: give OfferDeleteView a form_valid that, inside one transaction, ticks off (reminder.complete()) or deletes the linked reminder when it is still outstanding, then deletes the offer; better, a small withdraw_offer service beside record_offer and revise_offer that the view calls.

Done when

  • tests/test_offers.py::test_editing_and_deleting_from_the_page (or a new test beside it) asserts that after the delete the answer-by reminder is no longer outstanding.
Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the offer model and views and checking the result with a unit test against the snapshot. Related to #237. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. The code is now at `applications/views.py:1364-1375` (`OfferDeleteView`); `applications/models.py` and `applications/services.py` have not moved, and the same unit test gives the same result. The reminders page has since become the calendar's agenda (#316), so the calendar is where the reminder stays. Recording an offer with an answer-by date makes a reminder ("Answer … about their offer by …"). Deleting the offer does nothing to it: the reminder stays outstanding on the calendar and on the application's page, and the scheduler announces it through the person's notifiers the day before a date that belongs to an offer that no longer exists. - **Where:** `applications/views.py:1324-1335` (`OfferDeleteView`, a plain `DeleteView`), `applications/models.py:972-979` (`Offer.reminder`, `OneToOneField(..., on_delete=models.SET_NULL)`), `applications/services.py:645-679` (`_remind_to_answer`, which makes the reminder). - **What happens:** `on_delete=SET_NULL` protects the offer when its reminder is deleted; it says nothing about the reminder when the offer is deleted. `OfferDeleteView` has no `form_valid` of its own and there is no `post_delete` receiver for `Offer` (the only ones are in `documents/signals.py` and `jobs/signals.py`). Checked: an offer with `answer_by` a week out, deleted through `applications:offer_delete`; the reminder was still there with `done_at` `None` and due the day before at 09:00. - **Why it matters:** an offer recorded by mistake, or on the wrong application, keeps prompting the person to answer it. `_remind_to_answer` already ticks the reminder off when the date is taken away; deleting the offer is the same case. - **Fix:** give `OfferDeleteView` a `form_valid` that, inside one transaction, ticks off (`reminder.complete()`) or deletes the linked reminder when it is still outstanding, then deletes the offer; better, a small `withdraw_offer` service beside `record_offer` and `revise_offer` that the view calls. ## Done when - `tests/test_offers.py::test_editing_and_deleting_from_the_page` (or a new test beside it) asserts that after the delete the answer-by reminder is no longer outstanding.
tiagoagueda added this to the 0.6.0 milestone 2026-10-01 10:46:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#444
No description provided.