rubyforgood/casa

View on GitHub
app/services/deployment/backfill_case_contact_started_metadata_service.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module Deployment
  class BackfillCaseContactStartedMetadataService
    def backfill_metadata
      case_contacts = CaseContact.where("metadata->'status' IS NOT NULL AND metadata->'status'->'started' IS NULL")

      case_contacts.each do |case_contact|
        case_contact.metadata["status"]["started"] = case_contact.created_at.as_json
        case_contact.save!
      end
    end
  end
end