Skip to content

Fix sending of duplicate emails

Robbie Luijben requested to merge SDC-979/duplicate-emails into master

The save method on the LTARequest model was overridden and used to send e-mails, but the change detection (which queried the database) was not good enough:

  • now, update_fields in the LTARequest.save method is inspected to make sure that the status code is being changed (previously, it was also reacting to the request_token field being updated)
  • in the LTARequestStatus.save method (which calls LTARequest.save), change detection is also added to prevent duplicate save calls
  • a bit of useful logging has been left in place

Unit tests were added to check if a celery task is being sent (or not) and whether an LTARequestStatus correctly saves an LTARequest.

Edited by Robbie Luijben

Merge request reports