Browse Source

CLDC-2310 create sales log field import service and import bulk upload id field (#1783)

* some minor refactoring
remove methods from child class that replicate methods on the parent class
tidy up check for nil
remove gubbins and inline method body given only used once

* update import services for lettings and sales to import creation method
write tests to cover this

* create sales log field import service and associated spec file, with methods and tests for importing the creation method of logs that have already been imported

* update lettings log field import service and related spec to allow importing creation method of logs

* use the methods dynamically created by active record in all relevant places, removing obsolete methods in teh process.
various tests tweaked to suppor this change.
rake task from another ticket folded into this ticket to prevent merge conflicts

* rename method for ruby conventions

* update PR for altered spec
upload id now decided to be a better indicator of bulk upload status, import service amended accordingly
tests updated in line with this

* update field import services in line with import services to use upload id rather than upload method as the source of truth for how a log was created

* slight refactor to reduce nesting and dodge linter complaints

* minor amendment to log creator spec in bulk upload to use enum dynamic methods

* revert updating creation method in rake task with update all
pull/1784/head
Arthur Campbell 1 year ago committed by GitHub
parent
commit
5c78f50a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      lib/tasks/creation_method.rake

4
lib/tasks/creation_method.rake

@ -1,5 +1,5 @@
desc "set creation method to bulk upload if a log has a bulk upload id" desc "set creation method to bulk upload if a log has a bulk upload id"
task set_creation_method: :environment do task set_creation_method: :environment do
LettingsLog.where.not(bulk_upload_id: nil).find_each(&:creation_method_bulk_upload!) LettingsLog.where.not(bulk_upload_id: nil).update_all(creation_method: 2)
SalesLog.where.not(bulk_upload_id: nil).find_each(&:creation_method_bulk_upload!) SalesLog.where.not(bulk_upload_id: nil).update_all(creation_method: 2)
end end

Loading…
Cancel
Save