specifically, during bulk uploads an object is validated many times before saving
dirty checks only reset on save meaning after setting the UPRN the process_uprn_change code would run on every validation, leading to many calls
to solve this, add a flag to the log which blocks further UPRN calls if it tries to set the uprn twice to the same value. if different values are returned then continue checking
this offers a tradeoff between number of api calls and also should not break existing functionality
* CLDC-4028: Export records where a related one has updated
for instance, re-export all users in an org if the name updates
rework the export code a little to allow for this to be expressed cleanly
* CLDC-4028: Add tests
2 weeks ago
14 changed files with 320 additions and 46 deletions
LettingsLog.exportable.where("(updated_at >= :from AND updated_at <= :to) OR (values_updated_at IS NOT NULL AND values_updated_at >= :from AND values_updated_at <= :to)",params).filter_by_year(year)
SalesLog.exportable.where("(updated_at >= :from AND updated_at <= :to) OR (values_updated_at IS NOT NULL AND values_updated_at >= :from AND values_updated_at <= :to)",params).filter_by_year(year)
User.where("(updated_at >= :from AND updated_at <= :to) OR (values_updated_at IS NOT NULL AND values_updated_at >= :from AND values_updated_at <= :to)",params)